akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
using namespace std;

int main(){
    int n;
    cin >> n;
    long a[n];
    long b[n];
    bool is_turn = true;
    map<long, long, greater<long>> sa;
    map<long, int, greater<long>> sn;
    long ans = 0;
    int count = n;
    int num = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
        if(sa.find(a[i]+b[i]) == sa.end()){
            sa[a[i]+b[i]] = a[i];
            sn[a[i]+b[i]] = 1;
            num++;
        }else{
            sn[a[i]+b[i]]++;
            if(sn[a[i]+b[i]] % 2 == 0){
                ans -= b[i];
            }else{
                ans += a[i];
            }
        }
    }
    int itrn[num];
    int df = 0;
            for(auto itr_n = sn.begin(); itr_n != sn.end(); ++itr_n) {
                itrn[df] = itr_n->second;
                df++;
            }
    df = 0;
        for(auto itr = sa.begin(); itr != sa.end(); ++itr) {
            if(itrn[df] == 1){
                if(is_turn == true){
                    ans += itr->second;
                    count--;
                    df++;
                    is_turn = false;
                }else{
                    ans -= itr->first - itr->second;
                    count--;
                    df++;
                    is_turn = true;
                }
            }else{
                ans += itr->second;

                if(itrn[df] % 2 != 0){
                    is_turn = !is_turn;
                }
                count - itrn[df];
                df++;
            }
        }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14720
# K <= N(N-1)//2 - (N-1)
#    = (N-1)(N-2)//2

N, K = map(int, input().split())

if K > (N - 1) * (N - 2) // 2:
    print(-1)
else:
    M1 = N - 1
    M2 = (N - 1) * (N - 2) // 2 - K
    M = M1 + M2

    print(M)
    for i in range(1, N):
        print(N, i)
    m = 0
    for i in range(1, N):
        for j in range(i + 1, N):
            if m < M2:
                print(i, j)
                m += 1
            else:
                break
        if m == M2:
            break


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

const int MAX_H = 301;
const int MAX_W = 301;
char _data[MAX_H][MAX_W];
int H,W,K;

bool find(int y,int x){
  for(int i = x ; i < W ; i++){
    if(_data[y][i] == '#'){
      return true;
    }
  }
return false;
}

void display(vector<int> vec){
  cout << "display " << endl;
  for(int i = 0 ; i < vec.size() ; i++){
    cout << vec[i] << ' ';
  }
  cout << endl;
  cout << "display end " << endl;
}

int main(){
  cin >> H >> W >> K;

  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      char c; cin >> c;
      _data[i][j] = c;
    }
  }
  int now = 0;
  vector<vector<int> > res;
  for(int i = 0 ; i < H ; i++){
    vector<int>vec;
    if(!find(i,0)){
      res.push_back(vec);
      continue;
    }
    for(int j = 0 ; j < W ; j++){
      if(find(i,j)){
        now++;
        for( ; j < W ; j++){
          //cout << "j = " << j << endl;
          //cout << "now = " << now << endl;
          vec.push_back(now);
          if(_data[i][j] == '#'){
            break;
          }
        }
        //cout << "#1" << endl;
        //display(vec);
      }
      else {
        for( ; j < W ; j++){
         vec.push_back(now);
        }
        //cout << "#2" << endl;
        //display(vec);
      }
    }
    //cout << "#3" << endl;
    //display(vec);
    res.push_back(vec);
  }

  vector<int> pre_vec;
  for(int i = 0 ; i < res.size() ; i++){
    if(res[i].size() > 0){
      pre_vec = res[i];
      break;
    }
  }

  //cout << "res.size() = " << res.size() << endl;
  for(int i = 0 ; i < res.size() ; i++){
    //cout << "i = " << i << " res[i].size() = " << res[i].size() << endl;
    vector<int> now_vec = res[i];
    if(now_vec.size() == 0){
      now_vec = pre_vec;
    }
    for(int j = 0 ; j < now_vec.size() ; j++){
      if(j)cout << ' ' ;
      cout << now_vec[j];
    }
    cout << endl;
    pre_vec = now_vec;
  }
  return 0;
}


Measured memory_bytes: 4084
M=10**9+7
n,k=map(int,input().split())
from functools import lru_cache
@lru_cache(None)
def f(x):
  if x: return x*f(x-1)%M
  return 1
l=[f(i) for i in range(n+1)]
a=0
for i in range(min(n,k+1)):
  c=l[n]*l[n-1]%M
  p=l[i]**2*l[n-i]*l[n-i-1]%M
  a+=c*pow(p,M-2,M)
print(a%M)

Measured memory_bytes: 34420
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main()
{
	int t; cin>>t;
	while(t--){
		int a[5][5];
		rep(i,5) rep(j,5)
			cin>>a[i][j];
		int res=0;
		rep(i,5) rep(j,5) rep(k,6-i) rep(l,6-j){
			bool ok=true;
			rep(m,k) rep(n,l)
				ok&=a[i+m][j+n]==1;
			if(ok && k*l>res)
				res=k*l;
		}
		cout<<res<<endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll x, a;
    cin >> x >> a;

    if(x < a) cout << 0 << endl;
    else cout << 10 << endl;

    return 0;
}


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

int main()
{
	int N;
	double T, A;
	cin >> N >> T >> A;
	double a[1000];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		a[i] = T - 0.006 * a[i];
	}
	int best = 0;
	double dif = 1000;
	for (int i = 0; i < N; i++) {
		double dif_i = fabs(a[i] - A);
		if ( dif_i < dif) {
			best = i;
			dif = dif_i;
		}
	}
	cout << best + 1 << endl;
}

Measured memory_bytes: 256
s = input()
most = 0
acgt = ["A", "C", "G", "T"]
point = 0
for i in range(len(s)):
    if s[i] in acgt:
        point += 1
    else:
        if point > most:
            most = point
        point = 0
if point > most:
    most = point
point = 0
print(most)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define el '\n'
#define MOD 1000000007

int n, arr[100005], dp1[100005], dp2[100005];
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> arr[i];
    }
    dp1[0]=0;
    dp1[1]=arr[1];

    for(int i=2;i<=n;i++){
        dp1[i] = __gcd(dp1[i-1], arr[i]);
    }
    dp2[n]=arr[n];
    for(int i=n-1;i>=1;i--){
        dp2[i] = __gcd(dp2[i+1], arr[i]);
    }
    int fmax=-1;
    for(int i=1;i<=n;i++){
        int a = dp1[i-1];
        int b = dp2[i+1];

        fmax = max(fmax, __gcd(a, b));
    }
    cout << fmax << el;
    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main(void)
{
	int i, n, a, v, maxnumber, maxnum = 0;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%d %d", &a, &v);
		
		if (v > maxnum){
			maxnumber = a;
			maxnum = v;
		}
		else if (v == maxnum && a < maxnumber){
			maxnumber = a;
		}	
	}
	
	printf("%d %d\n", maxnumber, maxnum);
	
	return (0);
}

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

int main(){

    char a[3][3];

    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin>>a[i][j];
        }
    }

    cout<<a[0][0]<<a[1][1]<<a[2][2];

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(void){
    
    int a,b,c,count = 0;
    cin >>a>>b>>c;
    
    for(int x = a;x <= b; x++){
        if(c % x == 0){
            count++;
        }
    }
    cout << count << endl;
    
}


Measured memory_bytes: 3108
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
inline int read(){
	int res=0,sign=1;char ch;
	while((ch=getchar())<'0'||ch>'9')if(ch=='-')sign=-1;res=res*10+ch-48;
	while((ch=getchar())>='0'&&ch<='9')res=res*10+ch-48;
	return res*sign;
}
const int maxn=1e5+10;
int hp,n;
int f[maxn];
long long sum;
int main(){
    hp=read(),n=read();
    for(int i=1;i<=n;i++)
    	f[i]=read(),sum+=f[i];
    if(sum>=hp) puts("Yes");
    if(sum<hp) puts("No");
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n;
    cin>>n;
    int a[n];
    int b[n];
    int c[n-1];
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
        ans+=b[i];
    }
    for(int i=0;i<n-1;i++){
        cin>>c[i];
    }
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]+1){
            ans+=c[a[i-1]-1];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long int K;
  string S;
  cin >> S >> K;
  int ones=0;
  for(int i=0;i<(long long)S.size();i++){
    if(S[i] == '1') ones++;
    else break;
  }
  char ans;
  ans = S[ones];
  if(K <= ones) cout << '1' << endl;
  else cout << ans << endl;
}
  

Measured memory_bytes: 256
import java.util.Scanner;

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

		Scanner scan = new Scanner(System.in);
		String Nb1 = scan.next();
		int N = Integer.valueOf(Nb1);
		int[] nb = new int[N];

		for (int i = 0; i < N; i++) {
			String Nb = scan.next();
			nb[i] = Integer.valueOf(Nb);
		}
		int result=0;
		for(int i=0;i<N;i++) {
			result=result+nb[i];
		}
		result=result-N;
		System.out.println(result);

	}
}

Measured memory_bytes: 23764
using Base.Collections
N=parse(Int,readline())
A=map(x->parse(Int,x),split(readline()))
ans=-1145141919810931893
L=PriorityQueue(Int,Int)
now=0
for i=1:N
	now+=A[i]
	L[i]=A[i]
end
Lsum=Int[now]
for i=N+1:2N
	now+=A[i]
	L[i]=A[i]
	now-=peek(L).second
	dequeue!(L)
	push!(Lsum,now)
end
L=PriorityQueue(Int,Int)
now=0
for i=3N:-1:2N+1
	now+=A[i]
	L[i]=-A[i]
end
Rsum=Int[now]
for i=2N:-1:N+1
	now+=A[i]
	L[i]=-A[i]
	now+=peek(L).second
	dequeue!(L)
	push!(Rsum,now)
end
reverse!(Rsum)
for i=1:N+1
	ans=max(ans,Lsum[i]-Rsum[i])
end
println(ans)


Measured memory_bytes: 162036
#include <stdio.h>

// char s[5001], t[6], c[5];
// int k, n, l[6], i, j, iM;
int main() {
  int k, n, l[6] = {};
  char s[5001] = {}, t[6] = {}, c[5] = {};
  scanf("%s", s);
  scanf("%d", &k);
  n = 5000;
  int low = 0;
  while (n - low > 1) {
    int mid = (n + low) >> 1;
    (s[mid] ? low : n) = mid;
  }
  for (c[0] = 'a'; c[0] <= 'z'; ++c[0]) {
    t[0] = c[0];
    l[1 + 0] = -1;
    for (int i = l[0], iM = n - 0; i < iM; ++i) {
      if (s[i + 0] != t[0]) continue;
      l[1 + 0] = i;
      break;
    }
    if (l[1] < 0) continue;
    if (k == 1) {
      printf("%s\n", t);
      return 0;
    }
    --k;
    for (c[1] = 'a'; c[1] <= 'z'; ++c[1]) {
      t[1] = c[1];
      l[1 + 1] = -1;
      for (int i = l[1], iM = n - 1; i < iM; ++i) {
        if (s[i + 0] != t[0] || s[i + 1] != t[1]) continue;
        l[1 + 1] = i;
        break;
      }
      if (l[2] < 0) continue;
      if (k == 1) {
        printf("%s\n", t);
        return 0;
      }
      --k;
      for (c[2] = 'a'; c[2] <= 'z'; ++c[2]) {
        t[2] = c[2];
        l[1 + 2] = -1;
        for (int i = l[2], iM = n - 2; i < iM; ++i) {
          if (s[i + 0] != t[0] || s[i + 1] != t[1] || s[i + 2] != t[2]) continue;
          l[1 + 2] = i;
          break;
        }
        if (l[3] < 0) continue;
        if (k == 1) {
          printf("%s\n", t);
          return 0;
        }
        --k;
        for (c[3] = 'a'; c[3] <= 'z'; ++c[3]) {
          t[3] = c[3];
          l[1 + 3] = -1;
          for (int i = l[3], iM = n - 3; i < iM; ++i) {
            if (s[i + 0] != t[0] || s[i + 1] != t[1] || s[i + 2] != t[2] || s[i + 3] != t[3]) continue;
            l[1 + 3] = i;
            break;
          }
          if (l[4] < 0) continue;
          if (k == 1) {
            printf("%s\n", t);
            return 0;
          }
          --k;
          for (c[4] = 'a'; c[4] <= 'z'; ++c[4]) {
            t[4] = c[4];
            l[1 + 4] = -1;
            for (int i = l[4], iM = n - 4; i < iM; ++i) {
              if (s[i + 0] != t[0] || s[i + 1] != t[1] || s[i + 2] != t[2] || s[i + 3] != t[3] || s[i + 4] != t[4]) continue;
              l[1 + 4] = i;
              break;
            }
            if (l[5] < 0) continue;
            if (k == 1) {
              printf("%s\n", t);
              return 0;
            }
            --k;
          }
          t[4] = 0;
        }
        t[3] = 0;
      }
      t[2] = 0;
    }
    t[1] = 0;
  }
}


Measured memory_bytes: 1616
#include <stdio.h>

int linearSearch(int, int, int*);

int main() {
  int n, q, i, count = 0; 
  int s[10001], t;
  
  scanf("%d",&n);
  for(i = 0;i < n;i++) scanf("%d",&s[i]);
  scanf("%d",&q);
  for(i = 0;i < q;i++) {
    scanf("%d",&t);
    count += linearSearch(n,t,s);
  }
  printf("%d\n",count);
  
  return 0;
}

int linearSearch(int n, int key, int s[]) {
  int i = 0;
  s[n] = key;
  while(s[i] != key) {
    i++;
  }
  if(i != n) return 1;
  else return 0;
}

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

#define all(v)  begin(v), end(v)
#define int     long long
#define pii     pair<int, int>
#define endl    '\n';

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

    int a;
    string b;
    cin >> a >> b;
    int x, yy;
    x = stoi(b.substr(0, 1));
    yy = stoi(b.substr(2));
    cout << a*x + (a*yy) / 100 << endl;
}

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


int main(){
    

    while(1){
        int student;
        double m=0,dispersion=0,deviation;

        scanf("%d",&student);
        if(student == 0){
            break;
        }

        int score[student];

        for(int i = 0;i<student;i++){
            scanf("%d",&score[i]);
            m += score[i];
        }
        m /= student;

        //printf("%lf",m);

        for(int i = 0;i<student;i++){
            dispersion += pow(score[i] - m,2);
        }
        dispersion /= student;
        deviation = sqrt(dispersion);

        printf("%lf\n",deviation);
    }


    return 0;
}



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

int main(){
  int n,a[105]; cin >>n;
  rep(i,n) cin >>a[i];
  ll cost = 1001001001;
  for(int i = -100; i<=100; i++){
    ll curcost = 0;
    rep(j,n) curcost += (i-a[j])*(i-a[j]);
    cost = min(cost, curcost);
  }
  cout << cost << endl;
  return 0;
}

Measured memory_bytes: 3616
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
s=input()
acc=[0]*(n+1)
ans=n
for i in range(n):
    if s[i]=="#":
        acc[i+1]=acc[i]+1
    else:
        acc[i+1]=acc[i]
for i in range(n+1):
    w=n-i-(acc[n]-acc[i])
    b=acc[i]
    ans=min(ans,w+b)
print(ans)

Measured memory_bytes: 85848
#include<set>
#include<iostream>
int main(){
using namespace std;
int i=2,N,h,m;set<pair<int, int>> r;
while(i--&&cin>>N)while(N--&&cin>>h>>m)r.insert(make_pair(h,m));
for(auto i=r.begin();i!=r.end();)printf("%d:%02d",i->first,i->second),cout<<(++i!=r.end()?" ":"");cout<<endl;
}

Measured memory_bytes: 1228
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.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tarek
 */
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);
        CSumOfProductOfPairs solver = new CSumOfProductOfPairs();
        solver.solve(1, in, out);
        out.close();
    }

    static class CSumOfProductOfPairs {
        final static long mod = (long) 1e9 + 7;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int a[] = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            long sum = 0;
            long ans = 0;
            for (int i = 0; i < n; i++) {
                ans += (sum * a[i]) % mod;
                ans %= mod;
                sum += a[i];
                sum %= mod;
            }
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 55404
using System;
using System.Text;
 
namespace ALDS1_14_D
{
	class SuffixArray
	{
		internal int[] sa, rank, tmp;
		internal string S;
		internal int n, k;
		
		public SuffixArray(string SS)
		{
			S = SS;
			n = S.Length;
			sa = new int[n + 1];
			rank = new int[n + 1];
			tmp = new int[n + 1];
			Construct_SA();
		}
		
		public int Compare_SA(int i, int j)
		{
			if(rank[i] != rank[j]) return rank[i] - rank[j];
			
			int ri = i + k  <= n ? rank[i + k] : -1;
			int rj = j + k <= n ? rank[j + k] : -1;

			return  ri - rj; 
		}
		
		public void Construct_SA()
		{
			for(int i = 0; i < n; i++)
			{
				sa[i] = i;
				rank[i] = S[i];
			}
			sa[n] = n; rank[n] = -1;
			
			for(k = 1; k <= n; k*= 2)
			{
				Array.Sort(sa, Compare_SA);
                
                int d;
                d = tmp[sa[0]] = 0;
                for (int i = 1; i <= n; i++)
                {
                    d = tmp[sa[i]] = d + ((Compare_SA(sa[i - 1], sa[i]) < 0) ? 1 : 0);
                }
                for (int i = 0; i <= n; i++)
                {
                    rank[i] = tmp[i];
                }
 
			}
		}
		
		public string Contains(string pattern)
		{
			int l = 1, r = n + 1;
			int pl = pattern.Length;
			
			while(l < r)
			{
				int m = (l + r) / 2;
				
				string subStr = (sa[m] + pl > n) ? S.Substring(sa[m]) : S.Substring(sa[m], pl);
                    
                int comp = subStr.CompareTo(pattern);
                if (comp == 0) return "1";
                
                if (comp < 0) l = m + 1;
                else r = m;
			}
			return "0";
		}
	}
	
	
    class Program
    {
        static void Main(string[] args)
        {
        	var T = Console.ReadLine();
        	
            SuffixArray SA = new SuffixArray(T);
            StringBuilder sb = new StringBuilder();
 
            var Q = int.Parse(Console.ReadLine());
 
            for (int i = 0; i < Q; i++)
            {
                var P = Console.ReadLine();
 
                sb.AppendLine(SA.Contains(P));
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 32976
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int H = in.nextInt();
            int W = in.nextInt();
            char[][] Ss = new char[H][W];
            for (int i = 0; i < H; i++) {
                Ss[i] = in.next().toCharArray();
            }
            int[][][] counts = new int[H][W][2];
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if (Ss[i][j] == '.') {
                        // H
                        if (counts[i][j][0] == 0) {
                            for (int k = i; k < H; k++) {
                                if (Ss[k][j] == '.') {
                                    counts[i][j][0]++;
                                } else {
                                    break;
                                }
                            }
                            for (int k = i; k < H; k++) {
                                if (Ss[k][j] == '.') {
                                    counts[k][j][0] = counts[i][j][0];
                                } else {
                                    break;
                                }
                            }
                        }
                        // W
                        if (counts[i][j][1] == 0) {
                            for (int k = j; k < W; k++) {
                                if (Ss[i][k] == '.') {
                                    counts[i][j][1]++;
                                } else {
                                    break;
                                }
                            }
                            for (int k = j; k < W; k++) {
                                if (Ss[i][k] == '.') {
                                    counts[i][k][1] = counts[i][j][1];
                                } else {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            int max = 0;
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    max = Math.max(max, counts[i][j][0] + counts[i][j][1] - 1);
                }
            }
            out.println(max);
        }

    }
}



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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    map<int, string> f;
    f[25] = "Christmas";
    f[24] = "Christmas Eve";
    f[23] = "Christmas Eve Eve";
    f[22] = "Christmas Eve Eve Eve";
    int n;
    cin >> n;
    cout << f[n] << endl;
    return 0;
}


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

int main() {
  int t=0;
  long int K;
  cin>>K;
  long int a=7;
  long int b;
  for(int i=0;i<100000000;i++){
  a=a%K;
    if(a==0){t++;
            break;}
    else{t++;
        a=a*10+7;}
  }
if(t<99999999){
  cout<<t<<endl;}
  else{  cout<<-1<<endl;}

}





Measured memory_bytes: 3612
import sys
from collections import deque

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = input().rstrip()
q = int(input())
d = deque()
d.append(s)

flag = False
for i in range(q):
    qq = input().split()
    if qq[0] == '1':
        flag = not(flag)
    else:
        if flag:
            if qq[1] == '1':
                d.append(qq[2])
            else:
                d.appendleft(qq[2])
        else:
            if qq[1] == '1':
                d.appendleft(qq[2])
            else:
                d.append(qq[2])

ans = ''.join(list(d))
if flag:
    print(ans[::-1])
else:
    print(ans)


Measured memory_bytes: 90100
from collections import Counter

def main():
    n = int(input())
    a = list(map(int,input().split()))
    total = sum(a)
    counter = Counter(a)
    q = int(input())
    for i in range(q):
        b,c = map(int,input().split())
        num_of_changed_num = counter[b]
        counter[b] = 0
        counter[c] += num_of_changed_num
        total -= b * num_of_changed_num
        total += c * num_of_changed_num
        print(total)



if __name__ == '__main__':
    main()


Measured memory_bytes: 88948
d, g = map(int, input().split())
q_list = [list(map(int, input().split())) for x in range(d)]
count_list = []

for j in range(2**d):
    total = 0
    count = 0
    for i in range(d):
        if (j >> i) & 1:
            total += 100*(i+1)*q_list[i][0] + q_list[i][1]
            count += q_list[i][0]

    if total >= g:
        count_list.append(count)
        continue

    else:
        for t in range(d):
            digit = str(d)
            if str(format(j, '0'+digit+'b'))[t] == '0':
                for x in range(q_list[d-t-1][0]-1):
                    count += 1
                    total += 100 * (d-t)

                    if total >= g:
                        count_list.append(count)
                        break
                break

print(min(count_list))

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <algorithm>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
#include <cmath>
#include <stack>
#include <limits>
#include <ctime>

using namespace std;

#define ll long long
#define sc(n) static_cast<ll>(n)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {
	IO;
#ifdef _DEBUG
	ifstream cin("In.txt");
#endif	
	ll n,m,tot=0,a;
	cin >> n >> m;
	vector<ll>vc(n);
	for(int i = 0; i < n; i++) {
		cin >> a;
		tot += a;
		vc[i] = a;
	}
	int cnt = 0;
	for (auto& i : vc) {
		if ((i * 4 * m) >= tot) {
			cnt++;
		}
	}
	if (cnt >= m) {
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    data=sort([parseMap(split(readline())) for i in 1:n],by=x->x[2])
    now=0
    ans="Yes"
    for (a,b) in data
        now+=a
        if now>b
            ans="No"
            break
        end
    end
    println(ans)
end
main()

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

#define int long long

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

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

template<int32_t mod>
struct ModInt{
	int32_t a;
	inline int32_t normalize(int64_t x){
		x%=mod;
		if(x<0)x+=mod;
		return x;
	}
	ModInt(const int64_t a=0):a(normalize(a)){}

	ModInt& operator+=(const ModInt &x){
		a+=x.a;
		if(a>=mod)a-=mod;
		return *this;
	}
	ModInt& operator-=(const ModInt &x){
		a-=x.a;
		if(a<0)a+=mod;
		return *this;
	}
	ModInt& operator*=(const ModInt &x){
		a=(int64_t)a*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt x){return ModInt(*this)+=x;}
	ModInt operator-(const ModInt x){return ModInt(*this)-=x;}
	ModInt operator*(const ModInt x){return ModInt(*this)*=x;}
	ModInt operator/(const ModInt x){return ModInt(*this)/=x;}
	bool operator==(const ModInt x){return a==x.a;}
	bool operator!=(const ModInt x){return a!=x.a;}

	ModInt operator-(){return ModInt(0)-ModInt(*this);}
	ModInt pow(int64_t ex)const{
		int64_t x=a;
		int64_t res=1;
		while(ex){
			if(ex&1)res=res*x%mod;
			x=x*x%mod;
			ex>>=1;
		}
		return ModInt(res);
	}
	ModInt inv()const{return pow(mod-2);}
};

template<int32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<int32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}
using mint=ModInt<998244353>;

int gcd(int a,int b){
	return b?gcd(b,a%b):a;
}

int N;
int A[111111];

signed main(){
	cin>>N;
	rep(i,N)cin>>A[i];
	sort(A,A+N);

	mint ans=1;
	for(int i=0;i<N;i++)ans*=gcd(A[i],i);
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
	int N, M;
	cin >> N >> M;
	int **A = new int*[N];
	long long int sum = 0;

	for (int i = 0; i < N; i++)
	{
		A[i] = new int[2];
		for (int j = 0; j < 2; j++)
		{
			cin >> A[i][j];
		}
	}
	
	sort(&A[0], &A[N], [](auto& x, auto& y) {return x[0] < y[0]; });


	for (int i = 0; i < N; i++)
	{
		while(A[i][1]>0)
		{
			M--;
			A[i][1]--;
			sum += A[i][0];

			if (M == 0)	break;
		}
		if (M == 0)	break;
	}
	

	cout << sum << endl;

	for(int i = 0;i<N;i++)
	{
		delete[] A[i];
	}
	delete[] A;
	return 0;

}

Measured memory_bytes: 4224
/*
  Esteban Arango Medina
*/
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <tuple>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;

using ll=long long;
#define int ll

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <char,int> mci;
typedef map <int,int> mii;
typedef map <string,string> mss;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define endl '\n' // Normal `cout << endl` flushes the output every time wich hit performance badly
#define INF 1000000000
#define deb(x) cout<<#x<<": "<<x<<endl;
#define printArray(arr) for(auto x: arr) { cout<<x<<", "; }
#define printMatrix(mat) for(auto x: mat) { cout<<" "; printArray(x); cout<<endl; }
#define printMap(mmap) for(auto p: mmap) { cout<< p.first<<": "<<p.second<<endl; }

signed main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL); // Fast input
  #ifdef LOCAL_PROJECT
    freopen("in.in", "r", stdin);
    // freopen("out.out", "w", stdout);
  #endif
  int MOD = 1000000007;
  int T = 1; //cin>>T;
  while(T--) {
    int H, W;
    cin>>H>>W;
    vector<vector<char>> table(H, vector<char>(W));
    vector<vi> DP(H, vi(W, 0));
    rep(i, 0, H) {
      rep(j, 0, W) {
        cin>>table[i][j];
      }
    }
    rep(i, 1, H) {
      if(table[i][0] == '#') { break; }
      DP[i][0] = 1;
    }
    rep(j, 1, W) {
      if(table[0][j] == '#') { break; }
      DP[0][j] = 1;
    }

    rep(i, 1, H) {
      rep(j, 1, W) {
        if(table[i][j] == '#') { continue; }
        DP[i][j] = (DP[i][j-1]%MOD + DP[i-1][j]%MOD)%MOD;
      }
    }
    // printMatrix(DP);
    cout<<DP[H-1][W-1];
  }
  return 0;
}

Measured memory_bytes: 9088
#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;

int main(){
  int n;
  cin>>n;
  map<int,int>sum,ind;
  set<int>exist;
  rep(i,n){
    int a; cin>>a;
    sum[a]++;
    if(!ind.count(a))ind[a]=i;
    exist.insert(a);
  }

  //存在する要素だけを抽出する
  vector<int>x;
  x.push_back(0);
  for(auto p:exist)x.push_back(p);

  //累積和
  int m=x.size();
  for(int i=m-1; i>0; --i){
    sum[x[i-1]]+=sum[x[i]];
  }

  //index修正
  for(int i=m-1; i>0; --i){
    ind[x[i-1]]=min(ind[x[i-1]],ind[x[i]]);
  }

  //大きい方から見ていく
  vector<ll>ans(n);
  for(int i=m-1; i>0; --i){
    ans[ind[x[i]]]+=(ll)(sum[x[i]])*(ll)(x[i]-x[i-1]);
  }
  rep(i,n)cout<<ans[i]<<endl;
}

Measured memory_bytes: 18560
/*
    When you are not practicing someone else is,
    and the day u meet them u will Lose.

    So, all you need is Practice, Practice and Practice.
*/
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,a,b)       for(i=a;i<=b;i++)
#define FOR(i,a,b)      for(i=a;i>=b;i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define sz(v)           (int)v.size()
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p) {int ans=1;x%=mod;while(p>0){if(p&1)ans=(ans*x)%mod;p=p>>1;x=(x*x)%mod;}return ans;}
int inv(int x){return po(x,mod-2)%mod;}
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
/**********************************************************************************/



const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r,f,q;








void sol()
{   
    cin>>a>>b>>n;
    n-=a;
    if(n<=0)cout<<-n<<" "<<b;
    else
    {
        b-=n;
        cout<<0<<" "<<max(0ll,b);
    }
    
    
    
    
    //cout<<  <<endl;
}





int32_t main()
{   
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //pre();
    //sp(10);
    // w(t)
    sol();
    return 0;
}


Measured memory_bytes: 3624
#include <map>
#include <set>
#include <list>
#include <cstdio>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define fr first
#define sc second
#define mp make_pair

typedef long long int64;
typedef pair< int, int > iP;
typedef pair< iP, int > iiP;

const int INF = 2 << 28;
const double EPS = 1e-10;

int h, w, c;
vector<vector< int > > mas(10, vector< int >(10));
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
int visited[10][10];

int countC(int x, int y) {
    if(mas[y][x] != c) return 0;
    visited[y][x] = 1;
    int ret = 1;
    for(int i = 0; i < 4; i++) {
        int nx = x + dx[i], ny = y + dy[i];
        if(0 <= nx && nx < w && 0 <= ny && ny < h && !visited[ny][nx]) {
            ret += countC(nx, ny);
        }
    }
    return ret;
}

void change(int x, int y, int orig, int color) {
    visited[y][x] = 1;
    mas[y][x] = color;
    for(int i = 0; i < 4; i++) {
        int nx = x + dx[i], ny = y + dy[i];
        if(0 <= nx && nx < w && 0 <= ny && ny < h && !visited[ny][nx] && mas[ny][nx] == orig) {
            change(nx, ny, orig, color);
        }
    }
}

int rec(int cnt) {
    if(cnt == 5) {
        memset(visited, 0, sizeof(visited));
        return countC(0, 0);
    }

    int ret = 0;
    int prev = mas[0][0];
    vector< vector< int > > temp = mas;
    for(int i = 1; i <= 6; i++) {
        if(i == prev) continue;
        memset(visited, 0, sizeof(visited));
        change(0, 0, prev, i);
        ret = max(ret, rec(cnt + 1));
        mas = temp;
    }
    return ret;
}

int main() {

    while(cin >> h >> w >> c, h) {
        for(int i = 0; i < h; i++)
            for(int j = 0; j < w; j++)
                cin >> mas[i][j];

        cout << rec(0) << endl;
    }

}

Measured memory_bytes: 1220
#include "./bits/stdc++.h"
using namespace std;
using ll = long long;

int main(){
    int N,K,h;
    cin >> N >> K;
    ll v[N];
    for(int i=0;i<N;i++){
        cin >> v[i];
    }
    int INFTY = 100000000000;
    int min = INFTY;
    sort(v,v+N);
    for(int i=0;i<=N-K;i++){
        if(min > v[i+K-1] - v[i]){
            min = v[i+K-1] - v[i];
        }
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 4408
#include <bits/stdc++.h>
#define mxn (int)1e5+10
using namespace std;

int ar[mxn], dp[mxn];

// simple recursive
int solve(int n, int k) {

    if(n == 0) return 0;
    if(n < 0) return mxn;

    if(dp[n] != -1) return dp[n];

    int ans = INT_MAX;

    for(int i=1; i<=k; ++i) {
        ans = min(ans, solve(n-i, k) + abs(ar[n-i] - ar[n]));
    }

    return dp[n] = ans;
}

int main() {
    int n, k; cin >> n >> k;
    for(int i=0; i<n; ++i) cin >> ar[i];
    for(int i=0; i<mxn; ++i) dp[i] = -1;

    cout << solve(n-1, k) << '\n';

    return 0;
}


Measured memory_bytes: 7296
n=int(input())
T=list(map(int,input().split()))
AB=list(map(int,input().split()))
ans=0

for i in range(n):
  ans+=min(T[i]+T[i+1],AB[i])
  T[i+1]=max(0,T[i+1]-max(0,AB[i]-T[i]))
  
print(ans)


Measured memory_bytes: 19116
import java.util.Scanner;

class Main{
	public static void main (String[] args) {
		Scanner stdIn = new Scanner(System.in);
	    int n = stdIn.nextInt();
	    int m = stdIn.nextInt();
	    int[] l = new int[m];
	    int[] r = new int[m];
	    for(int i = 0;i < m;i++) {
	    	l[i] = stdIn.nextInt();
	    	r[i] = stdIn.nextInt();
	    }
	    int max = l[0];
	    int min = r[0];
	    for(int i = 1;i < m;i++) {
	    	if(min > r[i])
	    		min = r[i];
	    	if(max < l[i])
	    		max = l[i];
	    }
	    int k = min - max + 1;
	    if(k<0)
	    	System.out.println(0);
	    else
	    	System.out.println(k);
	}
}

Measured memory_bytes: 82168
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
ll ncd(ll n,ll d){
    ll x = 1,y=1;
    for(int i=0;i<d;i++){
        x = x*(n-i)%mod;
        y = y*(i+1)%mod;
    }
    return x*modpow(y,mod-2,mod)%mod;
}
int main() {    
    srand(time(NULL));
    for(int j=0;j<14;j++){
    for(int i=0;i<26;i++){
        cout<<i+1<<endl;
    }
    }
    for(int i=0;i<1;i++){

          cout<<rand()%26+1<<endl;  
    }
}
    



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> P;


int main(){
    int N;
    cin >> N;
    vector<LL> p(N), ind(N);
    multiset<LL>    s;
    for(int i = 0;i < N;i++){
        scanf("%d", &p[i]);
        p[i]--;
        ind[p[i]] = i;
    }
    s.insert(N);
    s.insert(N);
    s.insert(-1);
    s.insert(-1);
    LL ans = 0;
    LL l, ll, r, rr, cur;
    for(LL i = N-1;i >= 0;i--){
        cur = ind[i];
        auto curitr = s.lower_bound(cur);
//        l = *(--curitr);
//        ll = *(--curitr);
//        curitr = curitr2;
//        r = *(++curitr);
//        rr = *(++curitr);
        r = *curitr;
        curitr++;
        rr = *curitr;
        curitr--;
        curitr--;
        l = *curitr;
        curitr--;
        ll = *curitr;
        LL p1 = (rr - r) * (cur - l);
        LL p2 = (r - cur) * (l - ll);
        ans += (p1 + p2) * (i + 1);
        s.insert(cur);
    }
    cout << ans << endl;
}

Measured memory_bytes: 6528
// https://atcoder.jp/contests/abc172/tasks/abc172_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  string S, T;
  cin >> S >> T;

  ll res = 0;
  rep(i, S.size()) {
    if (S[i] != T[i]) res++;
  }

  cout << res << "\n";
}


Measured memory_bytes: 3768
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
#include <chrono>

#define _ << " " <<
#define all(v) v.begin(), v.end()
#define sp(n) fixed << setprecision(n)
#define ff first
#define ss second

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

const ll mod = 1e9 + 7;
const double eps = DBL_EPSILON;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << c - min(c, a - b);
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( stdin . lock ( ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ 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 ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        s: chars
    }
    let mut ret = 0;
    for i in 1..s.len()/2 {
        if is_ok(&s, i) {
            ret = i;
        }
    }
    println!("{}", ret*2);
}

fn is_ok(s: &[char], n: usize) -> bool {
    let mut ok = true;
    for i in 0..n {
        if s[i] != s[i+n] {
            ok = false;
        }
    }
    ok
}


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

int main()
{
    int a,b;
    cin>>a>>b;
    long long sum=0;
    int x=a;
    vector<long long > vv;
    while(a--)
    {
        int c;
        cin>>c;
        vv.emplace_back(c);
    }
    if(x<=b)
        cout<<0;
    else
    {
        sort(vv.begin(),vv.end());

        for(int i=0;i<(x-b);i++)
        {
            sum+=vv[i];
        }

        cout<<sum<<endl;


    }



}


Measured memory_bytes: 2420
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k=0;
string s, t;


int main()
{
	int p;
	cin >> a >> p;
	cout << (3 * a + p) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256