akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1<<17;



int main(){
    int N;
    cin >> N;
    vector<P> r,b;
    for(int i=0;i<N;i++){
        int a,b;
        cin >> a >> b;
        r.push_back(P(a,b));
    }
    sort(r.rbegin(),r.rend());
    for(int i=0;i<N;i++){
        int c,d;
        cin >> c >> d;
        b.push_back(P(d,c));
    }
    sort(b.begin(),b.end());
    int cnt=0;
    for(auto p:r){
        for(auto q=b.begin();q!=b.end();q++){
            if(p.first<q->second&&p.second<q->first){
                b.erase(q);
                cnt++;
                break;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main() {
  // しゃくとり
  int N, M, K; cin >> N >> M >> K;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<ll> B(M);
  for (int i = 0; i < M; i++) cin >> B[i];
  
  ll t = 0;
  for (int i = 0; i < M; i++) t += B[i];
  
  int j = M;
  int ans = 0;
  for (int i = 0; i < N+1; i++) {
    while (j > 0 && t > K) {
      j--;
      t -= B[j];
    }
    if (t > K) break;
    ans = max(ans, i + j);
    if (i == N) break;
    t += A[i];
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 6408
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,k,q;

    int i;
    cin>>n>>k>>q;
    int a[q];
    for(i=0;i<q;i++) {
        cin>>a[i];
    }
    vector<int>v(n);
    for(i=0;i<q;i++) {
        v[a[i]-1]++;
    }
    /*for(i=0;i<n;i++) {
        cout<<v[i]<<" ";
    }*/
    for(i=0;i<n;i++) {
        v[i]=k-q+v[i];
        if(v[i]<=0) {
            cout<<"No\n";
        }
        else {
            cout<<"Yes\n";
        }
    }
    return 0;
}


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

using namespace std;

void solve(int n, int offset) {
	if (n == 0) return;
	
	string p(offset, '.');
	
	if (n == 5) {
		printf("%sabbcc%s\n", p.c_str(), p.c_str());
		printf("%sadd.e%s\n", p.c_str(), p.c_str());
		printf("%sf..ge%s\n", p.c_str(), p.c_str());
		printf("%sf..gh%s\n", p.c_str(), p.c_str());
		printf("%siijjh%s\n", p.c_str(), p.c_str());
		
		return;
	}
	
	if (n == 6) {
		printf("%saabb.c%s\n", p.c_str(), p.c_str());
		printf("%s.d.eec%s\n", p.c_str(), p.c_str());
		printf("%sfd...j%s\n", p.c_str(), p.c_str());
		printf("%sf...kj%s\n", p.c_str(), p.c_str());
		printf("%sgmm.k.%s\n", p.c_str(), p.c_str());
		printf("%sg.hhii%s\n", p.c_str(), p.c_str());
		
		return;
	}
	
	if (n == 7) {
		printf("%saabb..c%s\n", p.c_str(), p.c_str());
		printf("%s.dd..ec%s\n", p.c_str(), p.c_str());
		printf("%s..ff.eg%s\n", p.c_str(), p.c_str());
		printf("%sh...i.g%s\n", p.c_str(), p.c_str());
		printf("%shk..i..%s\n", p.c_str(), p.c_str());
		printf("%smk..xx.%s\n", p.c_str(), p.c_str());
		printf("%sm..nnoo%s\n", p.c_str(), p.c_str());
		
		return;
	}
	
	string q(n - 4, '.');
	printf("%saa%scb%s\n", p.c_str(), q.c_str(), p.c_str());
	printf("%sbb%scb%s\n", p.c_str(), q.c_str(), p.c_str());
	
	solve(n - 4, offset + 2);
	
	printf("%sad%saa%s\n", p.c_str(), q.c_str(), p.c_str());
	printf("%sad%scc%s\n", p.c_str(), q.c_str(), p.c_str());
}

int main() {
	int n;
	ignore = scanf("%d", &n);
	if (n == 2) {
		printf("%d\n", -1);
	}
	else if (n == 3) {
		printf("aa.\n..a\n..a\n");
	}
	else {
		solve(n, 0);
	}
	
	return 0;
}


Measured memory_bytes: 1388
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (Math.abs(x-a) < Math.abs(x-b)) {
            System.out.println("A");
        } else {
            System.out.println("B");
        }
    }
}

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

int main()
{
  int N;
  cin >> N;
  
  map<string, bool> s_freq;
  rep(i, N)
  {
	string S;
    cin >> S;
    
    s_freq[S] = true;
  }
  
  (s_freq.size() == 3) ? printf("Three") : printf("Four");
}


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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

void solve(){
   int n,k;
   cin >> n >> k;

   int a[n+1];
   f(i,1,n+1) cin >> a[i];

   if(k <= n) {
      int cur = 1;
      while(k--) cur = a[cur];
      cout << cur << "\n";
      return ;
   }

   vi v;
   set<int> s;
   int cur = 1;
   f(i,1,n+1) {
      if(s.find(cur) != s.end()) {
         break;
      }
      v.pb(cur);
      s.insert(cur);
      cur = a[cur];
   }
   int id = 0;
   f(i,0,sz(v)) {
      if(v[i] == cur) {
         id = i;
         break;
      }
   }

   k -= id;
   vi v1;
   f(i,id,sz(v)) v1.pb(v[i]);
   cout << v1[(int)k % (sz(v1))];
}

int32_t main(){
   fast;
   int t = 1;
//   cin >> t;
   while(t--)  solve();   

}

Measured memory_bytes: 14400
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

int main(void)
{
    int N,M; cin >> N >> M;

    Graph G(N);

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

    // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    int ans = 0;
    for(int i = 0; i<N; i++){
        if(dist[i] != -1) continue;
        dist[i] += 1;
        que.push(i); // 0 を橙色頂点にする
        
        int count = 0;
        // BFS 開始 (キューが空になるまで探索を行う)
        while (!que.empty()) {
            int v = que.front(); // キューから先頭頂点を取り出す
            count++;
            que.pop();

            // v から辿れる頂点をすべて調べる
            for (int nv : G[v]) {
                if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

                // 新たな白色頂点 nv について距離情報を更新してキューに追加する
                dist[nv] = dist[v] + 1;
                que.push(nv);
            }
        }
        ans = max(ans, count);
    }

    cout << ans << endl;
}

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

int main() {

  int sx = 150;
  int sy = 150;

  int dx[4] = {  1,  0, -1,  0 };
  int dy[4] = {  0,  1,  0, -1 };

  /*
  int dd[7][7][2];
  int dt[7][7][2];
  int df[7][7][2];

  dd[1][2][0] = 3;
  dd[1][2][1] = 2;
  dt[1][2][0] = 2;
  dt[1][2][1] = 3;
  df[1][2][0] = 6;
  df[1][2][1] = 2;

  dd[1][3][0] = 0;
  dd[1][3][1] = 3;
  dt[1][3][0] = 2;
  dt[1][3][1] = 3;
  df[1][3][0] = 3;
  df[1][3][1] = 6;

  dd[1][4][0] = 2;
  dd[1][4][1] = 1;
  dt[1][4][0] = 2;
  dt[1][4][1] = 3;
  df[1][4][0] = 4;
  df[1][4][1] = 1;

  dd[1][5][0] = 1;
  dd[1][5][1] = 0;
  dt[1][5][0] = 2;
  dt[1][5][1] = 3;
  df[1][5][0] = 3;
  df[1][5][1] = 6;
  */

  int r[7][7];

  r[1][2] = 3;
  r[1][3] = 5;
  r[1][4] = 2;
  r[1][5] = 4;
  r[2][1] = 4;
  r[2][3] = 1;
  r[2][4] = 6;
  r[2][6] = 3;
  r[3][1] = 2;
  r[3][2] = 6;
  r[3][5] = 1;
  r[3][6] = 5;
  r[4][1] = 5;
  r[4][2] = 1;
  r[4][5] = 6;
  r[4][6] = 2;
  r[5][1] = 3;
  r[5][3] = 6;
  r[5][4] = 1;
  r[5][6] = 4;
  r[6][2] = 4;
  r[6][3] = 2;
  r[6][4] = 5;
  r[6][5] = 3;

  while( true ) {
    long long int n;
    cin >> n;
    if ( n == 0 ) break;

    long long int ue[300][300] = {0};
    long long int h[300][300] = {0};

    for ( long long int i = 0; i < n; i++ ) {

      long long int t, f;
      cin >> t >> f;

      long long int x = sx;
      long long int y = sy;

      while( true ) {

	vector< pair< int, int > > men;
	men.push_back( make_pair( -r[t][f], 0 ) );
	men.push_back( make_pair( -f, 1 ) );
	men.push_back( make_pair( -( 7 - r[t][f] ), 2 ) );
	men.push_back( make_pair( -( 7 - f ), 3 ) );

	sort( men.begin(), men.end() );

	bool flag = false;
	for ( int j = 0; j < 2; j++ ) {

	  int kx = x + dx[ men[j].second ];
	  int ky = y + dy[ men[j].second ];

	  if ( h[kx][ky] < h[x][y] ) {
	    x = kx;
	    y = ky;
	    flag = true;
	    if ( men[j].second == 0 ) {
	      t = 7 - r[t][f];
	    }else if ( men[j].second == 1 ) {
	      int k = t;
	      t = 7 - f;
	      f = k;
	    }else if ( men[j].second == 2 ) {
	      t = r[t][f];
	    }else if ( men[j].second == 3 ) {
	      int k = t;
	      t = f;
	      f = 7 - k;
	    }
	    break;
	  }

	}
	if ( flag == false ) {
	  h[x][y]++;
	  ue[x][y] = t;
	  break;
	}

      }

    }

    /*
    for ( long long int x = sx - 5; x < sx + 5; x++ ) {
      for ( long long int y = sy - 5; y < sy + 5; y++ ) {
	cout << ue[x][y] << "[" << h[x][y] << "] ";
      }
      cout << endl;
    }
    */

    long long int ans[7] = {0};
    for ( long long int x = 0; x < 300; x++ ) {
      for ( long long int y = 0; y < 300; y++ ) {
	ans[ ue[x][y] ]++;
      }
    }
    for ( int i = 1; i <= 6; i++ ) {
      if ( i > 1 ) cout << " ";
      cout << ans[i];
    }
    cout << endl;

  }

  return 0;

}

Measured memory_bytes: 2604
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>
#include<sstream>
#include<math.h>

using namespace std;

void Solution()
{
    while(1)
    {
         int n;
        long int s[1000] = {0};
        double m;
        long int sum = 0;
        double aa = 0;
        
        cin>>n;
    
        if(n == 0) break;
        
        for(int i = 0; i < n; i++)
        {
            cin>>s[i];
        }
    
        for(int i = 0; i < n; i++)
        {
            sum += s[i]; 
        }
    
        m = (double)sum / n;  //type change !
    
        for(int i = 0; i < n; i++)
        {
            aa += (s[i] - m) * (s[i] - m);
        }
        
        cout<<fixed<<setprecision(4)<<sqrt(aa / n)<<endl;
    }
        
}

int main()
{
    Solution();
    return 0;
}

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0)

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }

    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

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


#define INPUT_SIZE 3000000
char input[INPUT_SIZE];
char *ptr = input;

void init() {
	size_t read_byte = fread(input, 1, INPUT_SIZE-1, stdin);
	assert(read_byte);
	assert(read_byte < INPUT_SIZE-2);
}
int ri() {
	int r=0,s=0;
	for(;;){assert(*ptr);if(*ptr=='-'){s=1;break;}if(*ptr<='9'&&*ptr>='0'){r=*ptr-'0';break;}ptr++;}
	ptr++;
	for(;;){if(*ptr<'0'||*ptr>'9')break;r=r*10+*ptr-'0';ptr++;}
	ptr++;
	if(s)r=-r;
	return r;
}


int main() {
	init();
    int n = ri();
	int m = ri();
	int nn = 0;
	int mm = 0;
	int last = ri();
	FOR(i,n-1) {
		int a = ri();
		nn += ((s64)a-last)*(n-i-1)%1000000007*(i+1)%1000000007; nn %= 1000000007;
		last = a;
	}
	last = ri();
	FOR(i,m-1) {
		int a = ri();
		mm += ((s64)a-last)*(m-i-1)%1000000007*(i+1)%1000000007; mm %= 1000000007;
		last = a;
	}

	cout << (((s64)nn)*mm%1000000007) << endl;
    return 0;
}


Measured memory_bytes: 2432
N = int(input())
A = list(map(int,input().split()))

def func(A):
    A_inf = 0
    A_sup = 0
    N_inf = 0
    N_sup = 0
    L = sum(A)

    for a in A:
        if A_inf <= L/2 - a:
            A_inf += a
            A_sup += a
            N_inf += 1
            N_sup += 1
            continue
        else:
            if A_sup <= L/2 and A_sup + a > L/2:
                A_sup += a
                N_sup += 1
            break

    if A_inf == A_sup:
        return 0

    A_mid = A_sup - A_inf
    A_left = L/2 - A_inf
    A_right = A_sup - L/2
    A_lrmin = min(A_left, A_right)
    if A_mid-1 >= 2*A_lrmin:
        return int(2*A_lrmin)
    else:
        return int(A_mid)

print(func(A))

Measured memory_bytes: 26220
#include <stdio.h>
int main(void){
   int a,b;
   char op;
   while(1)
   {
    scanf("%d %c %d",&a,&op,&b);
    if(op == '?')break;
    if(op == '+'){printf("%d\n",a+b);}
   else if(op=='-'){printf("%d\n",a-b);}
   else if(op=='*'){printf("%d\n",a*b);}
   else if(op=='/'){printf("%d\n",a/b);}
   }

    return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
using namespace std;
#define sign(a) ((a>0)-(a<0))
#define LL long long
#define INF (LL)(1LL<<60)

void solve(long long N, std::vector<long long> a, std::vector<long long> b, std::vector<long long> c, long long Q, long long K, std::vector<long long> x, std::vector<long long> y){
    vector<LL> shortest(N, INF);
    vector<vector<pair<LL, LL>>> edges(N);
    for(LL i=0; i<N-1; i++){
        edges[a[i]-1].emplace_back(make_pair(b[i]-1, c[i]));
        edges[b[i]-1].emplace_back(make_pair(a[i]-1, c[i]));
    }

    function<void(LL, LL)> dfs = [&dfs, &shortest, N, edges](LL curr, LL l0){
        if(shortest[curr] <= l0)return;
        shortest[curr] = l0;
        for(auto dst: edges[curr]){
            dfs(dst.first, l0+dst.second);
        }
    };

    dfs(K-1, 0);

    for(LL i=0; i<Q; i++){
        cout << shortest[x[i]-1]+shortest[y[i]-1] << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    std::vector<long long> c(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
        scanf("%lld",&c[i]);
    }
    long long Q;
    scanf("%lld",&Q);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> x(Q);
    std::vector<long long> y(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, std::move(a), std::move(b), std::move(c), Q, K, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 26880
N=int(input())
S=list(input())

dp=[[0 for _ in range(i)] for i in range(N)]
#dp[i][j]:i文字目とj文字目からの共通文字の最大長さ(i>j)

for i in range(N-1):
  if S[i]==S[N-1]:
    dp[N-1][i]=1

for i in reversed(range(N-1)):
  for j in range(i):
    if S[i]==S[j]:
      dp[i][j]=dp[i+1][j+1]+1
      if j+dp[i][j]-1>=i:
        dp[i][j]=i-j

A=[]
for i in range(N):
  for j in range(i):
    A.append(dp[i][j])

print(max(A))


Measured memory_bytes: 379480
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a = 0;
  int b = 0;
  int ab = 0;
  
  cin >> a >> b;
  
  ab = (a * b)%2;
  
  if (ab == 0){
  cout << "Even" << endl;
  }
  else{
  cout << "Odd" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}

bool ok(int mid, vector<int> &A, int K) {
    int tmp = 0;
    REP(i,SZ(A)) {
        tmp += ceil((LD)A[i]/mid)-1;
    }
    return tmp <= K;
}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int N, K,sum = 0;
    cin >> N;
    vector<int> A(N);
    cin >> K;
    REP (i, N) {
        cin >> A[i];
    }

    if (K==0){
        print(*max_element(ALL(A)));
        return 0;
    }

    int left = 0, right = *max_element(ALL(A));
    while (left +1 < right) {
        int mid = (left+right)/2;
        if (ok(mid, A, K)) {
            right = mid;
        }
        else {
            left = mid;
        }
    }
    
    cout << right << endl;

    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc174/abc174_e && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc174/abc174_e && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc174/abc174_e && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 4732
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <iomanip>
using namespace std;

int main()
{
  int n ,k;
  cin >> n >> k;
  int p[n];
  int a;
  int sum = 0;
  int sum_max = 0;
  for(int i=0;i<n;++i){
    cin >> p[i];
    if(i < k){
      sum+=p[i];
      sum_max = sum;
    }else{
      sum+=(p[i]-p[i-k]);
      if(sum_max < sum){
        sum_max=sum;
      }
    }
  }
  cout << fixed << setprecision(8) << (double)(sum_max+k)/2.0 << endl;
}

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

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    char temp[n][n];
    char image[m][m];

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

    for(int i = 0; i < m; i++){
        for(int j = 0; j < m; j++){
            cin>>image[i][j];
        }
    }
    bool ok = false;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i+(m-1) >= n || j+(m-1) >= n) continue;
            bool match = true;
            for(int k = 0; k < m; k++){
                for(int l = 0; l < m; l++){
                    if(temp[i+k][j+l] != image[k][l]) match = false;
                }
            }
            if(match) ok = true;
        }
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	void run() {
		int n = in.nextInt() - 1;
		int[] a = new int[n];
		boolean[] minus = new boolean[n];
		long total = in.nextInt();
		for (int i = 0; i < n; i++) {
			minus[i] = "-".equals(in.next());
			a[i] = in.nextInt();
			total += a[i];
		}
		int i = 0;
		while (i < n && !minus[i]) {
			i++;
		}
		if (i == n) {
			out.println(total);
			return;
		}
		long bestSub = Long.MAX_VALUE;
		long sub = 0;
		while (i < n) {
			int x = a[i];
			long y = 0;
			i++;
			while (i < n && !minus[i]) {
				y += a[i];
				i++;
			}
			bestSub = Math.min(bestSub, sub + x + y);
			sub += x;
		}
		bestSub = Math.min(bestSub, sub);
		out.println(total - 2 * bestSub);
	}

	static MyScanner in;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		boolean stdStreams = true;
		String fileName = Main.class.getSimpleName().replaceFirst("_.*", "").toLowerCase();
		String inputFileName = fileName + ".in";
		String outputFileName = fileName + ".out";
		
		Locale.setDefault(Locale.US);
		BufferedReader br;
		if (stdStreams) {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			br = new BufferedReader(new FileReader(inputFileName));
			out = new PrintWriter(outputFileName);
		}
		in = new MyScanner(br);
		int tests = 1;//in.nextInt();
		for (int test = 0; test < tests; test++) {
			new Main().run();
		}
		br.close();
		out.close();
	}
	
	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		MyScanner(BufferedReader br) {
			this.br = br;
		}
		
		void findToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		
		String next() {
			findToken();
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 32324
def resolve():
    '''
    code here
    '''
    import sys
    import heapq
    queries = sys.stdin.readlines()
    
    heap = []

    for line in queries:
        query, *val = line.split()
        
        if query == 'insert':
            value = -1 * int(val[0])
            heapq.heappush(heap, value)
        if query == 'extract':
            print(-1 * heapq.heappop(heap))

    # print(heap)

if __name__ == "__main__":
    resolve()



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

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

    int n;
    cin >> n;
    vector<long long> A(n);
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }

    int right = 0;
    long long sum = 0, ans = 0;

    for(int left = 0; left < n; left++){
        while(right < n && ((sum ^ A[right]) == (sum + A[right]))){
            sum += A[right];
            right++;
        }

        ans += (long long)(right) - (long long)(left);

        if(left == right) right++;
        else sum -= A[left];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1920
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

void input(int &d, vector<ll> &c, vector<vector<ll>> &s, vector<int> &t, int &m, vector<pair<int, int>> &query) {
    cin >> d;
    s = vector<vector<ll>>(d, vector<ll>(26));
    t = vector<int>(d);
    c = vector<ll>(26);
    rep(i, 26) cin >> c[i];
    rep(i, d) rep(j, 26) cin >> s[i][j];
    rep(i, d) {
        int tmp_t;
        cin >> tmp_t;
        --tmp_t;
        t[i] = tmp_t;
    }
    cin >> m;
    query = vector<pair<int, int>>(m);
    rep(i, m) {
        int d, q;
        cin >> d >> q;
        --d, --q;
        query[i] = make_pair(d, q);
    }
    return;
}

vector<ll> calc_score(int d, vector<vector<ll>> &s, vector<int> &t, vector<ll> &c) {
    vector<ll> score(d);
    ll now_score = 0;
    vector<int> last_d(26, 0);
    rep(i, d) {
        rep(j, 26) {
            if (t[i] == j) {
                now_score += s[i][j];
                last_d[j] = i + 1;
            }
            else {
                now_score -= c[j] * ((i+1) - last_d[j]);
            }
        }
        score[i] = now_score;
    }
    return score;
}

int main() {
    int d;
    vector<ll> c;
    vector<vector<ll>> s;
    vector<int> t;
    int m;
    vector<pair<int, int>> query;
    input(d, c, s, t, m, query);

    auto score_v = calc_score(d, s, t, c);

    rep(i, m) {
        int query_d = query[i].first;
        t[query_d] = query[i].second;
        auto v = calc_score(d, s, t, c);
        cout << v[(int)v.size()-1] << endl;
    }

    return 0;
}


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

int main()
{
    int n, in, max=-__INT_MAX__, min=__INT_MAX__;
    long long sum=0;
    cin>>n;

    for(int i = 0; i < n; i++)
    {
        cin>>in;
        sum += in;
        if(max<in)
            max=in;
        if(min>=in)
            min=in;
    }

    cout<<min<<" "<<max<<" "<<sum<<endl;
    
    return 0;
}


Measured memory_bytes: 3104
program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,lm,rm
    integer(int32), allocatable:: x(:), sorted_x(:)

    read*, n
    allocate(x(n))
    allocate(sorted_x(n))
    read*, x(:)

    sorted_x(:) = x(:)
    call merge_sort(sorted_x,1,n)
    lm = sorted_x(n/2)
    rm = sorted_x(n/2+1)

    do i=1,n
        if (x(i) < rm) then
            print'(i0)', rm
        else
            print'(i0)', lm

        end if
    end do
    contains
    recursive subroutine merge_sort(ar, fst, lst)
    integer(int32),intent(inout):: ar(:)
    integer(int32),intent(in):: fst,lst
    integer(int32):: mdl

    if (lst-fst < 2) then
        if (ar(fst) > ar(lst)) call swap(ar(fst),ar(lst))
        return
    end if

    mdl = (fst+lst)/2
    call merge_sort(ar, fst, mdl)
    call merge_sort(ar, mdl+1, lst)
    call merge_(ar, fst, mdl, lst)
end subroutine

subroutine merge_(ar, fst, mdl, lst)
    integer(int32),intent(inout):: ar(:)
    integer(int32),intent(in):: fst, mdl, lst
    integer(int32),allocatable:: tmp(:)
    integer(int32):: li, ri, ti

    allocate(tmp(lst-fst+1))

    li=fst
    ri=mdl+1   
    ti=1

    do while (li <= mdl .and. ri <= lst)
        if (ar(li) <= ar(ri)) then
            tmp(ti) = ar(li)
            li=li+1
        else
            tmp(ti) = ar(ri)
            ri=ri+1
        end if
        ti=ti+1
    end do

    if (li <= mdl) then
        tmp(ti:) = ar(li:mdl)
    else
        tmp(ti:) = ar(ri:lst)
    end if

    ar(fst:lst) = tmp(:)
    deallocate(tmp)
end subroutine

subroutine swap(x,y)
    integer(int32),intent(inout):: x,y
    integer(int32):: tmp
    tmp = x
    x = y
    y = tmp
end subroutine
end program name

Measured memory_bytes: 4644
import sys
from functools import lru_cache

d={}

N=int(input())

for i in range(1,N+1):
    start=int(str(i)[0])
    end=int(str(i)[-1])
    tmp=d.get((start,end),0)
    d[(start,end)]=tmp+1

retval=0

for i in range(1,10):
    for j in range(1,10):
        retval+=d.get((i,j),0)*d.get((j,i),0)

print(retval)


Measured memory_bytes: 3572
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

lint dx[8] = { 0,1,1,1,0,-1,-1,-1 },
dy[8] = { 1,1,0,-1,-1,-1,0,1 };

template<class T>inline bool maxi(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

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

	lint a, b;
	cin >> a >> b;
	if (a + b == 15)co("+");
	else if (a*b == 15)co("*");
	else co("x");
	gc();
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll gcd_all(vector<ll> vec) {
  ll result = 0;
  for(int i=0; i<vec.size(); i++) result = gcd(result, vec[i]);
  return result;
}

int main() {
  int N, K; cin >> N >> K;
  vector<ll> A; rep(i,N) { ll tmp; cin >> tmp; A.push_back(tmp); }
  ll g = gcd_all(A);
  ll m = 0; for (auto x: A) m = max(m,x);
  string result = (K<=m && K%g==0) ? "POSSIBLE" : "IMPOSSIBLE";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1908
#!/usr/bin/perl

$line = 0;
while (<>) {
    if ($line == 0) {
        ($w, $h, $n) = split /\s/, $_;
    } else {
        @rec = split /\s/, $_;
        push @x, $rec[0];
        push @y, $rec[1];
        push @a, $rec[2];
    }
    $line++;
}

$x0 = 0;
$y0 = 0;
$xw = $w;
$yh = $h;

foreach $i (0 .. $n - 1) {
    if ($a[$i] == 1) {
        if ($xw <= $x[$i]) {
            print "0\n";
            exit;
        } elsif ($x0 < $x[$i]) {
            $x0 = $x[$i];
        }
    } elsif ($a[$i] == 2) {
        if ($x0 >= $x[$i]) {
            print "0\n";
            exit;
        } elsif ($xw > $x[$i]) {
            $xw = $x[$i];
        }
    } elsif ($a[$i] == 3) {
        if ($yh <= $y[$i]) {
            print "0\n";
            exit;
        } elsif ($y0 < $y[$i]) {
            $y0 = $y[$i];
        }
    } elsif ($a[$i] == 4) {
        if ($y0 >= $y[$i]) {
            print "0\n";
            exit;
        } elsif ($yh > $y[$i]) {
            $yh = $y[$i];
        }
    }
}

printf("%d\n", ($xw - $x0) * ($yh - $y0) );


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


#define EPS (1e-5)

typedef complex<double> P;

vector<P> crossPoint(P a,P b){
  vector<P> res;

  if(abs(abs(b-a) - 2.0) < EPS){
    P c = a + b;
    res.push_back( P(c.real()/2,c.imag()/2) );
  }
  else if(abs(b-a) < 2.0){
    //?????¨?????????????¨????
    P ab = b - a; //A??????B??????????????????
    P center = a + P(ab.real()/2,ab.imag()/2); //AB???????????????????????????
    P un1 = (ab * P(0, +1)) / abs(ab); //ab?????????????????????1
    P un2 = (ab * P(0, -1)) / abs(ab); //ab?????????????????????2
    double dist = sqrt(1 - pow(abs(ab) / 2, 2)); //AB????????????????????????????????§????????¢
    P c1 = center + un1 * dist; //??????????????????????????????1
    P c2 = center + un2 * dist; //??????????????????????????????2

    res.push_back(c1);
    res.push_back(c2);
  }

  return res;
}

int main(void){
  int n;

  while(cin>>n,n){
    P p[n];
    for(int i=0;i<n;i++){
      double x,y;
      char ch;
      cin>>x>>ch>>y;
      p[i] = P(x,y);
    }

    int ans = 1;
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
        vector<P> v = crossPoint(p[i],p[j]);
        if(v.empty()) continue;
        int countA = 2;
        int countB = 2;
        for(int k=0;k<n;k++){
          if(i == k || j == k) continue;
          if(abs(v[0]-p[k]) - 1.0 < EPS) countA++;
          if(v.size() == 2 && abs(v[1]-p[k]) - 1.0 < EPS) countB++;
        }
        ans = max(ans,max(countA,countB));
      }
    }
    cout<<ans<<endl;
  }

  return 0;
}

Measured memory_bytes: 3180
//Be Name Khoda, Besmellah Rahmane Rahim, In The Name Of God;
//#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>
#include <stdio.h>
#include <string.h>
#include<iomanip>
#include<unordered_map>
#include<unordered_set>
#include <fstream>

using namespace std;

const long long N = 1e5 + 5;
long long n;
set< pair<long long, long long> > s;
vector<long long> graph[N];
long long cnt[N];
long long par[N];
long long root, maxi;
vector< pair<long long, long long> > edge;
long long check = 0;

void dfs(long long v, long long par = -1, long long h = 0)
{
    check += h;
    for (auto u: graph[v])
    {
        if (u != par)
        {
            edge.push_back({v, u});
            dfs(u, v, h + 1);
        }
    }
}


int main() 
{
    cin >> n;
    for (long long i = 0; i < n; i++)
    {
        long long tmp;
        cin >> tmp;
        s.insert({-tmp, i});
    }
    while (s.size())
    {
        /*
        for (auto u: s)
        {
            cout << "(" << -u.first << ", " << u.second << ") ";
        }
        cout << endl;
        */
        auto p = (*s.begin());
        s.erase(s.begin());
        long long v = p.second;
        long long w = p.first;
        w = -w;
        cnt[v]++;
        long long tmp = w + cnt[v] - (n - cnt[v]);
        if (s.size())
        {
            auto nei = s.lower_bound({-tmp, -1});
            //cout << (*nei).first << " " << (*nei).second << endl;
            if (nei == s.end() || (*nei).first != -tmp)
            {
                cout << -1 << endl;
                exit(0);
            }
            par[v] = (*nei).second;
            //cout << v << " " << par[v] << endl;
            cnt[(*nei).second] += cnt[v];
        }
        else
        {
            root = v;
            maxi = w;
        }
    }
    for (long long i = 0; i < n; i++)
    {
        if (i == root)
        {
            continue;
        }
        graph[i].push_back(par[i]);
        graph[par[i]].push_back(i);
    }
    dfs(root);
    if (check != maxi)
    {
        cout << -1 << endl;
        exit(0);
    }
    for (long long i = 0; i < n - 1; i++)
    {
        cout << edge[i].first + 1 << " " << edge[i].second + 1 << endl;
    }
    
}







Measured memory_bytes: 19548
N = int(input())
A = list(map(int, input().split()))
sum_A = sum(A)
ans = 0
 
for i in range(N):
  sum_A = (sum_A - A[i])%(10**9 + 7)
  ans += A[i] * sum_A
  
print(ans%(10**9 + 7))

Measured memory_bytes: 31664
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        string s =  Console.ReadLine();
        string t =  Console.ReadLine();
        string subT = t.Substring(0,s.Length);
        Console.WriteLine(s.Equals(subT) ? "Yes" : "No");
    }
}

Measured memory_bytes: 25880
l,r = map(int,input().split())
mod = 2019
a = l%mod
b = r%mod

if r-l >= 2018:
    print(0)

else:
    if a > b:
        print(0)
    else:
        t = (a*(a+1))%mod
        for x in range(a,b):
            for y in range(x+1,b+1):
                if (x*y)%mod < t:
                    t = (x*y)%mod
        print(t)

Measured memory_bytes: 9148
#include <bits/stdc++.h>                 // [PRIMES]               1777 ~2^10.80
using namespace std;                     //                       10333 ~2^13.33
using ll = long long;                    // seq 1 128 | factor   100333 ~2^16.61
using ld = long double;                  //   | grep -v ' .* '  1300111 ~2^20.31
using vl = vector<ll>;                   //                    10300777 ~2^23.30
using vvl = vector<vl>;                  //                   100400999 ~2^26.58
using pll = pair<ll,ll>;                 //                  1300400999 ~2^30.28
using vpll = vector<pll>;                //                 10200500333 ~2^33.25
using vb = vector<bool>;                 //                100200400777 ~2^36.54
using vs = vector<string>;               //               1200300700111 ~2^40.13
const ll oo = 0x3f3f3f3f3f3f3f3fLL;      //              10200300500777 ~2^43.21
const ld eps = 1e-9;                     //             100200300400777 ~2^46.51
#define sz(c) ll((c).size())             //            1200300400600999 ~2^50.09
#define all(c) begin(c),end(c)           //           10200300400600111 ~2^53.18
#define mp make_pair                     //          100200300400600333 ~2^56.48
#define mt make_tuple                    //         1200300400500800999 ~2^60.06
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

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

	ll n, k; cin >> n >> k;
	vl as(n); FOR(i,0,n) cin >> as[i];

	vb dp(k+1);
	dp[0] = false;
	FOR(i,1,k+1) {
		bool next = false;
		for (ll a : as) {
			if (a <= i && !dp[i-a]) {
				next = true;
				break;
			}
		}
		dp[i] = next;
	}

	if (dp[k]) cout << "First\n";
	else cout << "Second\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;


int a[26];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	sort(ALL(s));
	if (s[0] != s[2] && s[0] == s[1] && s[2] == s[3]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <iostream>
using namespace std;
//onst int INF=0x3f3f3f3f,maxn=;
//vector<int>v[maxn];
//ap<int,string>mp[maxn];
//ueue<int>q[maxn];
//int a[naxm],n,m;
string s,t;
int main()
{
	int i,j,k,ans=0;
	cin>>s>>t;
	for(i=0;i<s.size();i++)
	{
		if(s[i]!=t[i])
			ans++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3828
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){//全てのbitが捨てられるまで。
        if(n&1) ans = (ans*x) % mod;//1番右のbitが1のとき。
        x = (x*x) % mod;
        n = n >> 1;//bit全体を右に1つシフトして一番右を捨てる。
    }
    return ans;
}

mint comb(ll n , ll r){
  mint x = 1, y = 1;
  REP(i,r){
    x *= i+1;
    y *= n-i;
  }
  return y/x;
}


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n,a,b;
  cin >> n >> a >> b;
  mint ans = 2;
  ans = ans.pow(n);
  ans -= 1;
  ans -= comb(n,a);
  ans -= comb(n,b);
  cout << ans;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

const int N = 15;
int main()
{	
		int a[N] = {0};
	
		for(int i = 0;i < 10;i++)
		{
			scanf("%d", &a[i]);
		}
		for(int i = 0;i < 10;i++)
		{
		for(int j = i;j < 10;j++)
		{
			if(a[i] < a[j])
			{
				int tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
			 }
		}
		for(int i = 0;i < 3;i++)	 
		{
			printf("%d\n", a[i]);
			 }			 
} 


Measured memory_bytes: 2680
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
 
#define debug(x) cerr<<#x<<'='<<x<<'\n'
#define Int const int &

inline void read(int &p) {
	char c=getchar();
	while (c<48 || c>57) {
		c=getchar();
	}
	p=0;
	while (c>47 && c<58) {
		p=p*10+c-48;
		c=getchar();
	}
}

int a[123456], b[123456];
int t[123456];
int main(void) {
	int n;
	cin>>n;
	for (int i=1; i<=n; i++) {
		read(a[i]);
		b[i]=a[i];
	}
	sort(a+1, a+1+n);
	int len=unique(a+1, a+1+n)-a-1;
	for (int i=1; i<=n; i++) {
		b[i]=lower_bound(a+1, a+1+len, b[i])-a;
	}
	for (int i=1; i<=n; i++) {
		t[b[i]]++;
	}
	int ans=0;
	for (int i=1; i<=n; i++) {
		if (t[i]%2!=0) {
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
typedef unsigned long long UL;
using namespace std;
UL L[87];
int main(int argc, char* argv[])
{
	L[0]=2;
	L[1]=1;
	int i;
	for (i=2;i<=86;i++){
		L[i]=L[i-1]+L[i-2];
	}
	UL N;
	cin>>N;
	cout<<L[N]<<endl;
	return 0;
}

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


int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int calc(int y,int m,int d){
	int res=d-1;
	if(2<m && y%4==0&&(y%100||y%400==0))res++;
	for(int i=0;i<m-1;i++)res+=days[i];
	y--;
	res+=y/400*146097;
	y%=400;
	res+=y/100*36524;
	y%=100;
	res+=y/4*1461;
	y%=4;
	res+=y*365;
	return res;
}

int main(){
	int y1,m1,d1,y2,m2,d2;
	while(cin>>y1>>m1>>d1>>y2>>m2>>d2){
		if(y1<0||m1<0||d1<0||y2<0||m2<0||d2<0)break;
		cout<<calc(y2,m2,d2)-calc(y1,m1,d1)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<cstdint>
using namespace std;

int main()
{
  uint64_t n;

  cin >> n;
  vector<uint64_t> vec;
  vec.resize(n);
  uint64_t f = 0;
  uint64_t l = 0;
  cin >> vec[0];
  for (uint64_t i = 1; i < n; ++i) {
    cin >> vec[i];
    if (vec[i-1] > vec[i] + l) {
      uint64_t a = vec[i-1] - vec[i] - l;
      f += a;
      l = l + a;
    }
    l = vec[i-1] - l;
  }
  f += (vec[n-1] - l - f) / 2;
  cout << 2 * f << " ";
  l = f;
  for (uint64_t i = 1; i < n; ++i) {
    cout << 2 * (vec[i-1] - l) << " ";
    l = vec[i-1] - l;
  }

  return 0;
}





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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
vi g[125252];

set<int> g2[125252];

int circles;
int last[125252];
bool pos[125252];

void f(vi c){
  int add = 0;
  for(int x : c){
    last[x] = -1;
  }
  REP(i,c.size()){
    int v = c[i];
    if(last[v] != -1){
      int to = last[v];
      add++;
      FOR(j,to,i)last[c[j]] = -1;
    }
    last[v] = i;
  }
  if(add==1 || circles+add>=3){
    circles += add;
    return;
  }
  // add == 2
  REP(i,c.size())pos[i]=false;
  for(int x : c){
    last[x] = -1;
  }
  c.pop_back();
  REP(i,c.size()){
    int v = c[i];
    if(last[v]!=-1){
      pos[last[v]] = true;
    }else{
      last[v] = i;
    }
  }
  queue<int> Q;
  REP(i,c.size()){
    int v = c[i];
    if(pos[i]){
      Q.push(v);
    }else if(pos[last[v]]){
      if(Q.front() == v){
        Q.pop();
      }else{
        circles += 3;
        return;
      }
    }
  }
  circles += add;
}

int main(){
  scanf("%d%d",&n,&m);
  REP(i,m){
    int a,b;
    scanf("%d%d",&a,&b);
    --a;--b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  // euler tour
  REP(i,n)if(g[i].size()%2 == 1){
    puts("No"); return 0;
  }
  REP(i,n)for(int x : g[i]){
    g2[i].insert(x);
  }
  int sss = 0;
  REP(i,n){
    int d = g[i].size() / 2;
    sss += d-1;
  }
  if(sss >= 3){
    puts("Yes"); return 0;
  }
  // dfs
  while(true){
    vi c1;
    int start = -1;
    REP(i,n)if(g2[i].size()){
      start = i;break;
    }
    if(start==-1)break;
    int cur = start;
    c1.push_back(cur);
    do{
      int to = *g2[cur].begin();
      g2[cur].erase(to); g2[to].erase(cur);
      cur = to;
      c1.push_back(to);
    }while(cur != start);
    f(c1);
    if(circles >= 3){
      puts("Yes"); return 0;
    }
  }
  puts("No");
  return 0;
}


Measured memory_bytes: 22776
/*
 * @Author: your name
 * @Date: 2020-01-23 11:10:24
 * @LastEditTime : 2020-01-23 11:15:22
 * @LastEditors  : Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \code\AT2653.cpp
 */
#include <bits/stdc++.h>
using namespace std;
int n,k,sum;
int a[50];
bool comp(int a,int b)
{
    return a>b;
}
int main() {
   //freopen(".in", "r", stdin);
  //freopen(".out", "w", stdout);
  scanf("%d %d",&n,&k);
  for (int i = 1; i <= n; i++)
  {
      /* code */
    cin>>a[i];
  }
  sort(a+1,a+n+1,comp);
  for (int i = 1; i <= k; i++)
  {
      /* code */
      sum+=a[i];
  }
  printf("%d\n",sum);
getchar();getchar();
    return 0;
}

Measured memory_bytes: 256