akhauriyash/Code-Regression huggingface dataset:
import sys
import bisect
k, t = [int(i) for i in sys.stdin.readline().split()]
a_ls = [int(i) for i in sys.stdin.readline().split()]
sum_a = sum(a_ls)
memo_ls = [[0 for i in range(k+1)]for j in range(t+1)]
memo_ls[0][0] = 1
for i, cake in enumerate(a_ls, 1):
    for j in range(k+1):
        memo_ls[i][j] = memo_ls[i-1][j]
        if j >= cake:
            memo_ls[i][j] = max(memo_ls[i-1][j-cake], memo_ls[i][j])

ls = [i for i, j in enumerate(memo_ls[-1]) if j > 0]
ind = bisect.bisect_left(ls, sum_a / 2)
if ls[ind] == sum_a // 2:
    print(0)
else:
    print(max(ls[ind] - ls[ind - 1] - 1, 0))

Measured memory_bytes: 49628
using System;

class Program
{
  private static void Main()
  {
    string str = Console.ReadLine();
    
    int count = 0;
    
    for(int i = 0; i < str.Length / 2; i++)
    {
      if(str[i] != str[str.Length - 1 - i])
        count++;
    }
    
    Console.WriteLine(count);
  }
}


Measured memory_bytes: 11092
import java.util.*;

public class Main{

	public static void main(String[] args) {
		Scanner scanf =new Scanner (System.in);

		int N =scanf.nextInt();
		int i,x,y;
		int a[]=new int [N],b[]=new int [N],c[]=new int [N];
	
		for (i=0; i<N; i++){
		a[i]=scanf.nextInt();b[i]=scanf.nextInt();c[i]=scanf.nextInt();
		if (a[i]>b[i]) {x=a[i]; a[i]=b[i]; b[i]=x;}
		if (b[i]>c[i]) {x=b[i]; b[i]=c[i]; c[i]=x;}}
		
		for (i=0; i<N; i++){
		if (a[i]*a[i]+b[i]*b[i]==c[i]*c[i]) 
		System.out.println("YES");
		else
		System.out.println("NO");}

		
	}
}

Measured memory_bytes: 24016
S = input()
MOD = 10**9+7

dp = [0]*13
dp[0] = 1
r = 1
for c in S[::-1]:
    dp2 = [0]*13
    for p in range(13):
        if c =='?':
            for d in range(10):
                k = (d*r+p)%13
                dp2[k] += dp[p]
        else:
            d = int(c)
            k = (d*r+p)%13
            dp2[k] += dp[p]
    for k in range(13):
        dp2[k] %= MOD
    r *= 10
    r %= 13
    dp = dp2
print(dp[5])

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

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

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

inline int topbit(unsigned long long x){
	return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
	return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
	return __builtin_parity(x);
}

struct UnionFindTree{
	vector<int32_t>par,sz;
	vector<vint>lis;
	UnionFindTree(int32_t n=0):par(n),sz(n),lis(n){
		for(int32_t i=0;i<n;i++){
			par[i]=i;
			sz[i]=1;
			lis[i].pb(i);
		}
	}
	int32_t find(int32_t x){
		return x==par[x]?x:par[x]=find(par[x]);
	}
	void unite(int32_t x,int32_t y){
		x=find(x);y=find(y);
		if(x==y)return;
		if(sz[x]<sz[y])swap(x,y);
		sz[x]+=sz[y];
		for(auto w:lis[y])lis[x].pb(w);
		par[y]=x;
	}
	bool same(int32_t x,int32_t y){
		return find(x)==find(y);
	}
	int32_t size(int32_t x){
		return sz[find(x)];
	}
};

int deg[222222];
bool isC[222222];

signed main(){
	int N,M;
	cin>>N>>M;
	vint A(M),B(M),C(M);
	rep(i,M)cin>>A[i]>>B[i]>>C[i],A[i]--,B[i]--;

	UnionFindTree uf(N);
	rep(i,M){
		uf.unite(A[i],B[i]);
		deg[A[i]]++;deg[B[i]]++;
	}

	int X=0;//cycle(size>=2)
	rep(i,N){
		if(uf.find(i)!=i)continue;
		if(uf.lis[i].size()==1)continue;
		isC[i]=true;
		for(auto w:uf.lis[i])if(deg[w]!=2)isC[i]=false;
		if(isC[i])X++;
	}


	vint lis,lis2;
	bool ex=false;
	int sum=0;
	int num=0;
	rep(i,M){
		if(A[i]==B[i]){
			if(C[i]==1)continue;
			if(uf.lis[uf.find(A[i])].size()==1&&deg[A[i]]==2)lis2.pb(C[i]);
			else lis.pb(C[i]);
		}
		else{
			sum+=C[i];
			num++;
			if(!isC[uf.find(A[i])]){
				if(C[i]>1)ex=true;
			}
		}
	}

	if(X==0){
		cout<<num<<endl;
		return 0;
	}


	X+=num;

	sort(all(lis));
	sort(all(lis2));

	if(!ex&&lis.size()==0){
		cout<<-1<<endl;
		return 0;
	}
	
	if(!ex){
		sum+=lis.back();
		X++;
		lis.pop_back();
	}

	while(true){
		if(sum>=X){
			cout<<X<<endl;
			return 0;
		}

		if(lis.size()==0&&lis2.size()==0){
			cout<<-1<<endl;
			return 0;
		}


		if(lis.size()&&sum+lis.back()>=X+1){
			cout<<X+1<<endl;
			return 0;
		}

		if(lis2.size()==0||(lis.size()>=2&&lis.back()+lis[lis.size()-2]>=lis2.back())){
			sum+=lis.back();
			X++;
			lis.pop_back();
			continue;
		}

		sum+=lis2.back();
		X+=2;
		lis2.pop_back();
	}

	return 0;
}


Measured memory_bytes: 17128
#include<iostream>

using namespace std;

typedef struct{
	int num;
	int len;
}kanzya;

int main(void){
	std::ios_base::sync_with_stdio();

	int n;
	int p,d1,d2;
	kanzya data;

	while(1){
		cin>>n;
		if(n==0) break;
		cin>>p>>d1>>d2;
		data.num=p;
		data.len=d1+d2;
		n--;
		while(n--){
			cin>>p>>d1>>d2;
			if(data.len<d1+d2){
				data.num=p;
				data.len=d1+d2;
			}
		}
		cout<<data.num<<" "<<data.len<<endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L
const int mxN = 1e9 + 7;


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int s1 = a[0];
    int s2 = a[n - 1];
    int i = 1;
    int j = n - 2;
    while (i <= j) {
        if (s1 > s2) {
            while (i <= j && s1 > s2) {
                s2 += a[j];
                j--;
            }
        }
        else {
            while (i <= j && s1 <= s2) {
                s1 += a[i];
                i++;
            }
        }
    }
    cout << abs(s1 - s2);
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>pppp(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
 
int main() {
 int N;
 cin>>N;
 vector<int>A(N);
 for(int i=0;i<N;i++){
   cin>>A[i];
 }
 sort(A.rbegin(),A.rend());
 int64_t ans=0;
 ans+=A[0];
 int cnt=N-2;
 for(int i=1;i<N;i++){
   for(int j=0;j<2;j++){
     if(cnt>0){ans+=A[i];cnt--;}
   }
 }
 cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 4044
#include<bits/stdc++.h>
using namespace std;
long long n,a[100005],x,ans=1,flag;
const int m=1e9+7;
int main()
{
    flag=1;
	cin>>n;
	for(int i=0;i<n;i++)
    {
        cin>>x;
        a[x]++;
    }
    if(n%2==0)
    {
        for(int i=1;i<n;i+=2)
            if(a[i]!=2) flag=0;
    }
    else
    {
        if(a[0]!=1) flag=0;
        for(int i=2;i<n;i+=2)
            if(a[i]!=2) flag=0;
    }
    if(flag)
    {
        n/=2;x=2;
        while(n>0)
        {
            if(n%2==1)
                ans=(ans*x)%m;
            n/=2;
            x=(x*x)%m;
        }
        cout<<ans<<endl;
    }
    else cout<<0<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#define MAX 100
#define INF 999999
#define WHITE 0
#define BLACK 2

void dijkstra();

int n, G[MAX][MAX];

int main()
{
  int i, j, u, v, c, k;

  scanf("%d", &n);
  for(i=0; i<n; i++)
    {
      for(j=0; j<n; j++) G[i][j] = INF;
    }

  for(i=0; i<n; i++)
    {
      scanf("%d %d", &u, &k);
      for(j=0; j<k; j++)
	{
	  scanf("%d %d", &v, &c);
	  G[u][v] = c;
	}
    } 
  
  dijkstra();
  
  return 0;
}

void dijkstra()
{
  int d[n], color[n], i, u, v, mincost;

  for(i=0; i<n; i++)
    {
      d[i] = INF;
      color[i] = WHITE;
    }

  d[0] = 0;
  while(1)
    {
      mincost = INF;
      for(i=0; i<n; i++)
	{
	  if( d[i] < mincost && color[i] != BLACK )
	    {
	      mincost = d[i];
	      u = i;
	    }
	}

      if(mincost == INF)break;

      color[u] = BLACK;

      for(v=0; v<=n; v++)
	{
	  if(G[u][v] == INF) continue;

	  if(d[v] > d[u] + G[u][v]) 
	    {
	      d[v] = d[u] + G[u][v];
	    }
	}
    }
  
  for(i=0; i<n; i++)
    {
      printf("%d %d\n", i, d[i]);
    }
}

Measured memory_bytes: 1064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	string str;
	cin>>str;
	int count = 0;
	char c = 'R';
	int ans = 0;
	for(int i=0;i<str.length();i++)
	{
		if(str[i] == 'R')
			count++;
		else
			count = 0;
		ans = max(ans, count);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <tuple>

using namespace std;

using int64 = long long;

const int64 INF = (1LL<<60);

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

    vector<int> a(A), b(B);

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

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

    int res = (1<<30);

    for (int i = 0; i < M; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        --x, --y;
        res = min(res, a[x] + b[y] - c);
    }

    res = min(res, *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end()));

    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 1024
A1 = list(map(str,input().split()))
A2 = list(map(str,input().split()))
A3 = list(map(str,input().split()))
N = int(input())
for k in range(N):
  i = str(input())  
  if i == A1[0]:
    A1[0] = 'OK'
  if i == A1[1]:
    A1[1] = 'OK'
  if i == A1[2]:
    A1[2] = 'OK'
  if i == A2[0]:
    A2[0] = 'OK' 
  if i == A2[1]:
    A2[1] = 'OK'
  if i == A2[2]:
    A2[2] = 'OK'
  if i == A3[0]:
    A3[0] = 'OK'
  if i == A3[1]:
    A3[1] = 'OK'
  if i == A3[2]:
    A3[2] = 'OK'
if A1 == ['OK','OK','OK'] or A2 == ['OK','OK','OK'] or A3 == ['OK','OK','OK']:
  print('Yes')
  exit()
for i in range(3):
  if A1[i] == 'OK' and A2[i] == 'OK' and A3[i]== 'OK':
    print('Yes')
    exit()
if A1[0] == 'OK' and A2[1] == 'OK' and A3[2]== 'OK':
    print('Yes')
    exit()
if A1[2] == 'OK' and A2[1] == 'OK' and A3[0]== 'OK':
    print('Yes')
    exit()
print('No')




Measured memory_bytes: 9316
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
  ll n,tt;
  cin>>n>>tt;
  ll ans=tt;;
  vector<ll> t(n);
  rep(i,0,n) cin>>t[i];
  rep(i,0,n-1){
    ans+=min(t[i+1]-t[i],tt);
  }
  cout<<ans;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
#include<iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    set<string> data;
    rep(i, n){
        cin >> s[i];
        data.insert(s[i]);
    }
    int t;
    for(int i = 0; i < n-1; i++){
        t = s.at(i)[s.at(i).size()-1];
        if(t != (int)s.at(i+1)[0]){
            cout << "No" << endl;
            return 0;
        }
    }
    if(data.size() == n){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll n, m;
  cin >> n >> m;
  vector<string> a(n), b(m);
  for (ll i = 0; i < n; i++) cin >> a[i];
  for (ll i = 0; i < m; i++) cin >> b[i];

  for (ll i = 0; i < n - m + 1; i++) {
    for (ll j = 0; j < n - m + 1; j++) {
      for (ll k = 0; k < m; k++) {
        if (b[k] == a[i + k].substr(j, m)) {
          if (k == m - 1) {
            Yes();
            return 0;
          }
          continue;
        }
        else {
          break;
        }
      }
    }
  }
  No();
}

Measured memory_bytes: 256
#include <stdio.h>

#define L 8
#define Y 1
#define N 0

typedef struct{
  int row[L],col[L];
  int dpos[L*2],dneg[L*2];
} Queen;

void putQ(int);
void print(void);

Queen Q;
int X[L][L];

int main(){
  int r, c, b;
  int i, j, k;

  for(i = 0; i < L; i++){
    Q.row[i] = N;
    Q.col[i] = N;
  }

  for(i = 0; i < L*2; i++){
    Q.dpos[i] = N;
    Q.dneg[i] = N;
  }

  for(i = 0; i < L; i++){
    for(j = 0; j < L; j++){
      X[i][j] = 0;
    }
  }

  scanf("%d", &k);

  for(i = 0; i < k; i++){
    scanf("%d%d", &r, &c);

    X[r][c] = 1;
  }
  
  putQ(0);
  
  return 0;
}


void putQ(int i){
  int j;
  
  if(i == L){
    print();
    return;
  }

  for(j = 0; j < L; j++) {
    if(Q.col[j] == Y || Q.dpos[i+j] == Y || Q.dneg[i-j + L-1] == Y) continue;

    Q.row[i] = j;
    Q.col[j] = Q.dpos[i+j] = Q.dneg[i-j + L-1] = Y;
    
    putQ(i+1);
    
    Q.col[j] = Q.dpos[i+j] = Q.dneg[i-j + L-1] = N;
  }
}


void print(void){
  int i, j;

  for(i = 0; i < L; i++){
    for(j = 0; j < L; j++){
      if(X[i][j] == 1){
	if(Q.row[i] != j) return;
      }
    }
  }

  for(i = 0; i < L; i++){
    for(j = 0; j < L; j++){
      if(Q.row[i] == j) printf("Q");
      else printf(".");
    }

    printf("\n");
  }
}



Measured memory_bytes: 2112
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int h, w;

        while(true){
            h = scanner.nextInt();
            w = scanner.nextInt();
            if(h == 0 && w == 0)break;
            for(int i = 0; i < h; i++){
                if(i == 0 || i == (h-1)){
                    for(int j = 0; j < w; j++){
                        System.out.print("#");
                    }
                }
                else{
                    for(int j = 0; j < w; j++){
                        if(j == 0 || j == w-1){
                            System.out.print("#");
                        }else{
                            System.out.print(".");
                        }
                    }
                }
                System.out.println("");
            }
            System.out.println("");
        }
    }
}



Measured memory_bytes: 33872
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x ,a,b ;
  cin >> x >> a >>b;
  int A = max(a-x,x-a);
  int B = max(b-x,x-b);
  if(A>B){
    cout << 'B';
  }
  else{
    cout << 'A';
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define mp make_pair
 
const int MOD = 1000000007;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    int n,k;
    cin>>n>>k;
    int arr[n+1];
    for(int i=0;i<n;i++)
        cin>>arr[i+1];
    int dp[n+1];
    dp[1]=0;
    dp[2]=abs(arr[2]-arr[1]);

    for(int i=3;i<=n;i++)
    {
        dp[i]=dp[i-1]+abs(arr[i]-arr[i-1]);
        for(int j=2;j<=k;j++)
        {
            if(i-j==0)
                break;
            dp[i]=min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));
        }
    }
    cout<<dp[n];

    return 0;
} 

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 1;
    for (int i = 0; i < n - 1; i++) {
        if (s.at(i) != s.at(i + 1)) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main() {
	int n; cin >> n;
	int h[100];

	int count = 0;
	int maxv = 0;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
		if (maxv <= h[i]) {
			maxv = h[i];
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
#include<set>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
	char s[110];
	cin >> s;
	cout << s[0] << strlen(s) - 2 << s[strlen(s) - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
/* package whatever; // don't place package name! */
 
import java.util.*;
import java.lang.*;
import java.io.*;
 
public class Main
{
	public static void main (String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		long x = in.nextLong();
		long y = in.nextLong();

		
			int len = 1;
			x += x;
			while(x <= y) {
				++len;
				x += x;
			}

			System.out.println(len);
		

 	}

}

Measured memory_bytes: 22740
s = input()
l = len(s)
dp = [0]*2019
dp[0] = 1
r = 0
for i in range(1, l + 1):
    r += int(s[-i]) * pow(10, i - 1, 2019)
    r %= 2019
    dp[r] += 1
    
print(sum([(i * (i - 1)) // 2 for i in dp]))

Measured memory_bytes: 68392
import sys

def check(b0, b1):
    is_sheep[0] = b0
    is_sheep[1] = b1
    
    for i in range(1, N):
        if s[i] == 'o':
            if is_sheep[i]:
                is_sheep[(i+1)%N] = is_sheep[i-1]
            else:
                is_sheep[(i+1)%N] = not is_sheep[i-1]
        else:
            if is_sheep[i]:
                is_sheep[(i+1)%N] = not is_sheep[i-1]
            else:
                is_sheep[(i+1)%N] = is_sheep[i-1]
    
    if b0 == is_sheep[0]:
        if s[0] == 'o':
            if b0:
                return is_sheep[N-1]==is_sheep[1]
            else:
                return is_sheep[N-1]!=is_sheep[1]
        else:
            if b0:
                return is_sheep[N-1]!=is_sheep[1]
            else:
                return is_sheep[N-1]==is_sheep[1]
    else:
        return False
 
N = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()

is_sheep = [False] * N
 
for b0, b1 in [(False, False), (False, True), (True, False), (True, True)]:
    if check(b0, b1):
        ans = ['S' if is_sheep[i] else 'W' for i in range(N)]
        print(''.join(ans))
        break
else:
    print(-1)

Measured memory_bytes: 49648
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	int n;
	cin>>n;
	REP(i, n) {
		ll res1 = 0, res2 = 0;
		string a, b;
		cin>>a>>b;
		REP(i, a.size()) {
			if(a[i] == 'm') {
				if(i - 1 >= 0 && '2' <= a[i - 1] && '9' >= a[i - 1]) {
					res1 += (a[i - 1] - '0') * 1000;
				} else {
					res1 += 1000;
				}
			}
			if(a[i] == 'c') {
				if(i - 1 >= 0 && '2' <= a[i - 1] && '9' >= a[i - 1]) {
					res1 += (a[i - 1] - '0') * 100;
				} else {
					res1 += 100;
				}
			}
			if(a[i] == 'x') {
				if(i - 1 >= 0 && '2' <= a[i - 1] && '9' >= a[i - 1]) {
					res1 += (a[i - 1] - '0') * 10;
				} else {
					res1 += 10;
				}
			}
			if(a[i] == 'i') {
				if(i - 1 >= 0 && '2' <= a[i - 1] && '9' >= a[i - 1]) {
					res1 += (a[i - 1] - '0') * 1;
				} else {
					res1 += 1;
				}
			}
		}
		REP(i, b.size()) {
			if(b[i] == 'm') {
				if(i - 1 >= 0 && '2' <= b[i - 1] && '9' >= b[i - 1]) {
					res2 += (b[i - 1] - '0') * 1000;
				} else {
					res2 += 1000;
				}
			}
			if(b[i] == 'c') {
				if(i - 1 >= 0 && '2' <= b[i - 1] && '9' >= b[i - 1]) {
					res2 += (b[i - 1] - '0') * 100;
				} else {
					res2 += 100;
				}
			}
			if(b[i] == 'x') {
				if(i - 1 >= 0 && '2' <= b[i - 1] && '9' >= b[i - 1]) {
					res2 += (b[i - 1] - '0') * 10;
				} else {
					res2 += 10;
				}
			}
			if(b[i] == 'i') {
				if(i - 1 >= 0 && '2' <= b[i - 1] && '9' >= b[i - 1]) {
					res2 += (b[i - 1] - '0') * 1;
				} else {
					res2 += 1;
				}
			}
		}
		ll res = res1 + res2;
		string ans = "";
		if(res % 10 >= 2) {
			ans = to_string(res % 10) + 'i' + ans;
		} else if(res % 10 == 1) {
			ans = 'i' + ans;
		}
		res /= 10;
		if(res % 10 >= 2) {
			ans = to_string(res % 10) + 'x' + ans;
		} else if(res % 10 == 1) {
			ans = 'x' + ans;
		}
		res /= 10;
		if(res % 10 >= 2) {
			ans = to_string(res % 10) + 'c' + ans;
		} else if(res % 10 == 1) {
			ans = 'c' + ans;
		}
		res /= 10;
		if(res % 10 >= 2) {
			ans = to_string(res % 10) + 'm' + ans;
		} else if(res % 10 == 1) {
			ans = 'm' + ans;
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

int main(){
  int n,k;
  cin >> n >> k;
  vi a(n);
  rep(i,n) cin >> a[i];
  rep(i,n-k){
    if(a[i]<a[i+k]) cout << "Yes" << "\n";
    else cout << "No" << "\n";
  }
  
  return 0;
}

Measured memory_bytes: 4036
S = input()
ans = 0

K = ('A', 'C', 'G', 'T')
for i in range(len(S)):
    cnt = 0
    if S[i] not in K:
        continue
    else:
        cnt += 1
    for j in range(i+1, len(S)):
        if S[j] not in K:
            break
        cnt += 1
    if ans < cnt:
        ans = cnt

print(ans)


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

int main(void){
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;
    int sum = 0;
    sum = K*X+(N-K)*Y;
    if(K >= N)
    sum = N*X;
    cout << sum << endl;
    return 0;
}

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



int main(){
  int N;
  cin>>N;
  
  vector<int> vec(8);
  int nizi=0;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    if(a/400==0) vec.at(0)++;
    else if(a/400==1) vec.at(1)++;
    else if(a/400==2) vec.at(2)++;
    else if(a/400==3) vec.at(3)++;
    else if(a/400==4) vec.at(4)++;
    else if(a/400==5) vec.at(5)++;
    else if(a/400==6) vec.at(6)++;
    else if(a/400==7) vec.at(7)++;
    else if(a/400>=8) nizi++;
  }
  int sai=0;
  for(int i=0;i<8;i++){
    if(vec.at(i)>=1) sai++;
  }
  int deka=sai+nizi;
  if(sai==0&&nizi>=1) sai=1;
  cout<<sai<<" "<<deka<<endl;
    
  
}

Measured memory_bytes: 3564
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <tuple>

using namespace std;

int main()
{  
    string S;
    cin >> S;
    if(S.at(0) == S.at(1)){
        cout << "Bad" << endl;
    }
    else if(S.at(1) == S.at(2)){
        cout << "Bad" << endl;
    }
    else if(S.at(2) == S.at(3)){
        cout << "Bad" << endl;
    }
    else{
        cout << "Good" << endl;
    }
}

Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <set>
#include <map>
#include <bitset>

using namespace std;

typedef long long LL;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		LL n = -1, x, y;
		cin >> n >> x >> y;
		if (n < 0) return 0;
		vector<LL> ans(n - 1);
		for (LL i = 1; i < n; ++i) {
			for (LL j = i + 1; j <= n; ++j) {
				LL d = min(j - i, abs(i - x) + 1 + abs(j - y));
				ans[d - 1] += 1;
			}
		}
		for (auto x : ans) {
			cout << x << endl;
		}
	}
	return 0;
}


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

#define FOR(i,a,b) for(i=(a);i<(b);i++)
#define RFOR(i,a,b) for(i=(b);i>=(a);i--)
#define REP(i,n) for(i=0;i<(n);i++)
#define RREP(i,n) for(i=(n)-1;i>=0;i--)
#define MREP(i,n,x) for(i=0;i<(n);i=x)
#define IL() while(1)
#define mLOOP(a,b) while((a)<(b)) 
#define MLOOP(a,b) while((a)>(b))
#define ELOOP(a,b) while((a)==(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)>(b)?(b):(a))
#define ABS(x) ((x)<0?-1*(x):(x))
#define in scanf
#define out printf
#define ll long long
#define uul unsigned long long
#define int(x) scanf("%d",&x);
#define sint(x,y) scanf("%d %d",&x,&y);
#define lint(x,y) scanf("%d\n%d",&x,&y);
#define char(x) scanf("%c",&x);
#define double(x) scanf("%lf",&x);
#define string(x,n) scanf("%s",x);

int cmp(const void *a,const void *b){
  int tmp1 = *(int *)a;
  int tmp2 = *(int *)b;
  return tmp1-tmp2;
}

int main(){
    int a[3];
    int i;
    REP(i,3){
        int(a[i]);
    }
    qsort(a,3,sizeof(int),cmp);
    if(a[0] == 5 && a[1] == 5 && a[2] == 7){
        out("YES\n");
    }else{
        out("NO\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define YN(y, n, b) (b? y : n)
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    i32 A, B, C;
    cin >> A >> B >> C;
    if ((B + C) - A >= 0) cout << (B + C) - A << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 3624
using namespace std;

#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm>

typedef pair<int, int> ii;
typedef vector<int> vi;

int n, T;
int c[105], t[105];

signed main() {
  scanf("%d%d", &n, &T);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &c[i], &t[i]);
  }

  int INF = 1005;
  int cost = INF;
  for (int i = 0; i<  n; i++) {
    if (t[i] <= T) cost = min(cost, c[i]);
  }
  if (cost == INF) printf("TLE\n");
  else printf("%d\n", cost);
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int D, G, p[11], c[11];
    cin >> D >> G;
    for(int i = 0; i < D; ++i){
        cin >> p[i] >> c[i];
    }

    int ans = 1e9;
    for(int mask = 0; mask < (1 << D); ++mask){
        int s = 0, num = 0, rest_max = -1;
        for(int i = 0; i < D; ++i){
            if(mask >> i & 1){
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            }else{
                rest_max = i;
            }
        }
        if(s < G){
            int s1 = 100 * (rest_max + 1);
            int need = (G - s + s1 - 1) / s1;
            if(need >= p[rest_max]){
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
N=int(input())
S=input()
s=[int(c) for c in(S)]
a=0
for i in range(10):
  flag1=-1
  f1=0
  for p in range(N):
    if flag1==-1 and s[p]==i:
      flag1=p
      f1=1
      break
  for j in range(10):
    flag2=0
    f2=0
    for q in range(flag1+1,N):
      if f1==0:
        break
      if flag2==0 and s[q]==j:
        flag2=q
        f2=1
        break
    for h in range(10):
      for r in range(flag2+1,N):
        if f2==0:
          break
        if s[r]==h:
          if f1*f2!=0:
            a+=1
          break
print(a)

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

int main() {
  int N, a;
  int x, y, z;
  cin >> N;
    vector<int> vec(N);
  for (int i = 0; i < N; i++) {
  cin >> vec.at(i);
  }
  a=0;
  if(N <3)
    a=0;
  else{
    for(int i=0; i<N-2; i++){
       for(int j=i+1; j<N-1; j++){
          for(int k=j+1; k<N; k++){
             x=vec.at(i);
            y=vec.at(j);
            z=vec.at(k);
            if(y>z)
              swap(y,z);
            if(x>y)
              swap(x,y);
            if(y>z)
              swap(y,z);
            if(x != y && y!=z && z < x+y)
              a++;
          }
       }
    }
  }
  cout << a << endl;           
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

ll N;
ll A[100000];
ll M, res, S[100001];

int main() {
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	int L, R;
	L = 0, R = 222222;
	ll t;
	while (L + 1 != R) {
		int m = (L + R) / 2;
		t = 0;
		for (int i = 0; i < N; i++) {
			t += A + N - lower_bound(A, A + N, m - A[i]);
		}
		if (t >= M) {
			L = m;
		}
		else {
			R = m;
		}
	}
	t = 0;
	for (int i = 0; i < N; i++) {
		t += A + N - lower_bound(A, A + N, L - A[i]);
	}
	for (int i = N - 1; i >= 0; i--) {
		S[i] = S[i + 1] + A[i];
	}
	for (int i = 0; i < N; i++) {
		res += (N-(lower_bound(A, A + N, L - A[i]) - A))*A[i];
	}
	cout << res*2- (t - M)*L << endl;
}

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,k; cin >> n >> k;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  sort(ALL(a));
  int ans = 0;
  REP(i,k) ans += a[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define RREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
#define YY cout << "Yes" << endl
#define NN cout << "No" << endl
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
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 solve(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>>v(m);
  vector<int>p(m);
  rep(i,m){
    int k;
    cin>>k;
    rep(j,k){
      int tmp;
      cin>>tmp;
      tmp--;
      v[i].push_back(tmp);
    }
  }
  rep(i,m)cin>>p[i];
  int ans=0;
  rep(i,(1<<n)){
    int tmp=0;
    rep(j,m){
      int cnt=0;
      rep(k,v[j].size()){
        if(i & (1<<v[j][k]))cnt++;
      }
      if(cnt%2==p[j])tmp++;
    }
    if(tmp==m)ans++;
  }
  cout<<ans<<endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define per(i, n, s) for (int i = (n-1); i >= (int)(s); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;

int main(){
    int n; cin>>n;
    vector<int> l(2*n);
    rep(i,0,2*n) cin>>l[i];
    sort(all(l));
    int ans=0;
    for(int i=0; i<2*n; i+=2){
        ans+=l[i];
        // debug(i);
    }
    cout<<ans<<endl;
}

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

typedef long long int ll;

int main()
{
    ll n;
    cin >> n;
    vector<pair<ll,ll>> xy(n);
    for(ll i = 0;i < n;i++){
        cin >> xy[i].first >> xy[i].second;
    }
    sort(xy.begin(),xy.end());

    ll ans = n, cnt = 0;
    for(ll i = 0;i < n;i++){
        for(ll j = i + 1;j < n;j++){
            ll mx = 0;
            ll tp = xy[i].first - xy[j].first;
            ll tq = xy[i].second - xy[j].second;
            for(ll k = 0;k < n;k++){
                for(ll l = k + 1;l < n;l++){
                    if(xy[k].first - xy[l].first == tp && xy[k].second - xy[l].second == tq){
                        mx++;
                        break;
                    }
                }
            }
            cnt = max(cnt,mx);
        }
    }
    
    ans = n - cnt;

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int a[]=new int[n];
		int count=0;
		int sum=0;
		for(int i=0;i<n;i++){
		    a[i]=sc.nextInt();
		    sum+=a[i];
		}
		double min=((double)sum/(4*(double)m));
		 for(int i=0;i<n;i++){
		    if(a[i]<min)
		    continue;
		    else
		    count++;}
		    
		 if(count>=m)   
		System.out.println("Yes");
		else
		System.out.println("No");
	}
}


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

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5])
        cout << "Yes";
    else
        cout << "No";
}


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

using namespace std;

#define ll long long

void solve() {
	int n;
	cin >> n;
	vector<int> cnt(100001, 0);
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		cnt[a]++;
		cnt[a+1]++;
		if (a > 0) {
			cnt[a-1]++;
		}
	}
	sort(cnt.rbegin(), cnt.rend());
	cout << cnt[0] << "\n";
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 3732
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

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

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

template <typename T>
void quit(T a)
{
    cout << a << endl;
    exit(0);
}

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from,
                                      // to}}的に使う。
const ll LINF = 10010020030040056ll;
const int INF = 1001001001;
const double pi = acos(-1);

void solve()
{
    int n;
    cin >> n;
    vector<int> h(n);
    int ans = 0;
    int tmp = 0;
    cin >> h[0];
    for (int i = 1; i < n; i++)
    {
        cin >> h[i];
        if (h[i - 1] >= h[i])
        {
            tmp++;
        }
        else
        {
            tmp = 0;
        }
        chmax(ans, tmp);
    }
    cout << ans << endl;
}

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

    solve();
    return 0;
}


Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    int a[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    if (n % 2 == 0) {
        for (int i = n; i > 1; i -= 2) {
            cout << a[i] << " ";
        }
        for (int i = 1; i <= n; i += 2) {
            cout << a[i] << " ";
        }
    } else {
        for (int i = n; i >= 1; i -= 2) {
            cout << a[i] << " ";
        }
        for (int i = 2; i <= n; i += 2) {
            cout << a[i] << " ";
        }    
    }
    cout << "\n";
}

Measured memory_bytes: 3712
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		long k = sc.nextLong();
		long[] asum = new long[n+2];
		long[] bsum = new long[m+2];

		Arrays.fill(asum, k+1L);
		Arrays.fill(bsum, k+1L);
		asum[0] = 0L;
		bsum[0] = 0L;

		long a = 0L;
		int amax = 0;
		for ( int i=1; i<=n; i++ ) {
			a += sc.nextLong();
			if ( a<=k ) {
				asum[i] = a;
				amax++;
			}
		}

		long b = 0L;
		int bmax = 0;
		for ( int i=1; i<=m; i++ ) {
			b += sc.nextLong();
			if ( b<=k ) {
				bsum[i] = b;
				bmax++;
			}
		}

		int p = amax;
		int q = 0;
		int g = 0;

		while ( p>=0 && q<bmax ) {
			long bsub = k - asum[p];
			if ( bsum[q+1]<=bsub ) {
				q = nibutan(bsum, q+1, bmax+1, bsub);
			}
			g = Math.max(g, p+q);
			p--;
		}

		System.out.println(g);
	}

	private static int nibutan(long[] ary, int mn, int mx, long target) {
		if (mx-mn<=1) return mn;
		int md = (mn+mx)/2;
		if ( ary[md]<=target) return nibutan(ary, md, mx, target);
		else                  return nibutan(ary, mn, md, target);
	}
}

Measured memory_bytes: 62828
#include <bits/stdc++.h>
using namespace std;
template<class T> bool chmax(T& a,T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a,T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	string s, t;
	cin >> s >> t;
	int n = s.length();
	
	if (t.substr(0, n) == s) {
		cout << "Yes" << '\n';
	} else {
		cout << "No" << '\n';
	}
}

Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;

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

    int ans = 0;
    sort(a, a + n + 1);
    for (int i = 0; i <= n - k; ++i) {
        ans += a[i];
    }
    cout << ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
typedef int ll;
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define orz ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);    
#define inp freopen("input.txt","r",stdin);freopen("out.txt","w",stdout); 
ll mod1=1e9+7;
void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout.tie(NULL);    
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
}

int main() {
    orz;
    //inp;
    int a,b;
    cin>>a>>b;
    cout<<max(max(a+b,a-b),a*b);    

}




Measured memory_bytes: 256
//kuch tho karna hai 
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
void solve(int n) 
{ 
    char str[N]; 
    int i = 0; 
    while (n > 0) { 
        int rem = n % 26; 
  		if (rem == 0) { 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else{
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
    reverse(str, str + strlen(str)); 
    cout << str << endl; 
    return; 
}
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n ;
		solve(n);	
	
	}
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define mem(a,x) memset(a,x,sizeof(a))
#define rep(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i <= _##i; ++i)
#define repd(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i >= _##i; --i)
#define debug(x...) printf("["#x"]="),print(x);
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fcout cout<<setprecision(4)<<fixed
using namespace std;
typedef long long ll;
//======================================
namespace FastIO{
char print_f[105];void read() {}void print() {putchar('\n');}
template <typename T, typename... T2>
inline void read(T &x, T2 &... oth){x = 0;char ch = getchar();ll f = 1;while (!isdigit(ch)){if (ch == '-')f *= -1;ch = getchar();}while (isdigit(ch)){x = x * 10 + ch - 48;ch = getchar();}x *= f;read(oth...);}
template <typename T, typename... T2>
inline void print(T x, T2... oth){ll p3=-1;if(x<0) putchar('-'),x=-x;do{print_f[++p3] = x%10 + 48;}while(x/=10);while(p3>=0) putchar(print_f[p3--]);if(sizeof...(T2)) putchar(' ');print(oth...);}} // namespace FastIO

using FastIO::print;
using FastIO::read;
//======================================
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn = 1e6+5;

int main() {
#ifndef ONLINE_JUDGE
    freopen("H:\\code\\in.in", "r", stdin);
    freopen("H:\\code\\out.out", "w", stdout);
    clock_t c1 = clock();
#endif
//**************************************
    int n;
    read(n);
    ll ans=0;
    rep(i,1,n){
        ans+=n/i;
        if(n%i==0) ans--;
    }
    print(ans);
//**************************************
    
#ifndef ONLINE_JUDGE
    cerr << "Time:" << clock() - c1 << "ms" << endl;
#endif
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>

using namespace std;

#define MAX 1000000

int main(void) {
	bool isprime[MAX] = {false};

	for(int i = 3; i < MAX; i += 2) {
		isprime[i] = true;
	}
	isprime[2] = true;
	for(int i = 3; i * i <= MAX; i += 2) {
		if(!isprime[i]) continue;
		for(int j = i * i; j < MAX; j += i) {
			isprime[j] = false;
		}
	}
	
	while(1) {
		int a, d, n;
		int p_count = 0;
		scanf("%d %d %d", &a, &d, &n);
		if(!n) break;
		for(int i = a; i < MAX; i += d) {
			if(!isprime[i]) continue;
			p_count++;
			if(p_count == n) {
				printf("%d\n", i);
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 2168
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut cand = vec![0; 100010];
    for i in 0..n {
        if a[i] > 0 {
            cand[a[i] - 1] += 1;
        }
        cand[a[i]] += 1;
        cand[a[i] + 1] += 1;
    }

    println!("{}", cand.iter().max().unwrap());
}


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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int n, k;
    cin >> n >> k;

    if (n % k == 0)
        cout << "0" << endl;
    else
        cout << "1" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n;
    while(cin>>n,n){
        vector<int>V(n);
        for(int i=0;i<n;i++)cin>>V[i];
        sort(V.begin(),V.end());
        int sum=0;
        for(int i=1;i<n-1;i++)sum+=V[i];
        sum/=(n-2);
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 1216