akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;
public class Main {
	public static void main(String[] args){
		Main main = new Main();
		main.solveC();
	}

	private void solveA() {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (a - b == b - c) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

	private void solveB() {
		Scanner sc = new Scanner(System.in);
		String o = sc.nextLine();
		String e = sc.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < e.length(); i++) {
			sb.append(o.charAt(i));
			sb.append(e.charAt(i));
		}
		if (o.length() != e.length()) {
			sb.append(o.charAt(o.length() - 1));
		}
		System.out.println(sb.toString());
	}

	private void solveC() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.nextLine();
		int[] min = new int[26];
		for (int i = 0; i < 26; i++) {
			min[i] = 51;
		}
		for (int i = 0; i < n; i++) {
			int[] tmp = new int[26];
			String buffer = sc.nextLine();
			for (int j = 0; j < buffer.length(); j++) {
				char asc = buffer.charAt(j);
				tmp[(asc - 'a')]++;
			}
			for (int j = 0; j < 26; j++) {
				if (min[j] > tmp[j]) {
					min[j] = tmp[j];
				}
			}
		}
		StringBuilder sb = new StringBuilder();
		for (char c = 'a'; c <= 'z'; c++) {
			for (int i = 0; i < min[c - 'a']; i++) {
				sb.append(c);
			}
		}
		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 21844
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int cnt[1001];

int main(void){
	scanf("%d",&n);
	for(int i=2;i<=n;i++){
		int j=2;
		int ii=i;
		while(ii>=j){
			if(ii%j==0){
				cnt[j]++;
				ii/=j;
			}else{
				j++;
			}
		}
	}
	ll res=1;
	for(int i=2;i<=n;i++){
		res=(ll)res*(cnt[i]+1LL)%MOD;
	}
	printf("%lld\n",res);
	return 0;
}


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

int main() {

  int index[256] = {};
  bool b[5][14];
  char itoc[5];
  char c;
  int num;
  int N;

  index['S'] = 1; itoc[1] = 'S';
  index['H'] = 2; itoc[2] = 'H';
  index['C'] = 3; itoc[3] = 'C';
  index['D'] = 4; itoc[4] = 'D';

  for(int i = 0; i < 5; ++i) {
    for(int j = 0; j < 14; ++j) {
      b[i][j] = false;
    }
  }

  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> c >> num;
    b[index[c]][num] = true;
  }

  for(int i = 1; i < 5; ++i) {
    for(int j = 1; j < 14; ++j) {
      if( not b[i][j] ) {
	std::cout << itoc[i] << " " << j << std::endl;
      }
    }
  }
  
  return 0;
}

Measured memory_bytes: 1160
program hi;
var 
    n, m, i, sum, cnt: integer;
    a: array[0..110] of integer;

begin
    sum := 0; cnt := 0;
    readln(n, m);
    for i := 0 to n do begin
        read(a[i]);
        sum := sum + a[i];
    end;
    for i := 0 to n do begin
        if a[i] >= sum / (4 * m) then
            cnt := cnt + 1;
    end;
    if cnt >= m then
        writeln('Yes')
    else
        writeln('No');
end.

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

int n,pos=0;
vector<int> pre,in,post;

void rec(int l,int r){
	if(r<=l) return;
	int root=pre[pos++];
	int m=distance(in.begin(),find(in.begin(),in.end(),root));
	rec(l,m);
	rec(m+1,r);
	post.push_back(root);
}

int main(){
	int k;
	cin>>n;
	
	for(int i=0;i<n;i++){
		cin>>k;
		pre.push_back(k);
	}
	
	for(int i=0;i<n;i++){
		cin>>k;
		in.push_back(k);
	}
	
	rec(0,n);
	for(int i=0;i<n;i++){
		if(i) cout<<" ";
		cout<<post[i];
	}
	cout<<endl;
	
	return 0;
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

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

ll ngcd(vector<ll> a) {
  ll res = a[0];
  for(ll i=1; i<a.size() && res!=1; i++) res = gcd(a[i], res);
  return res;
}
ll nlcm(vector<ll> a){
  ll res = a[0];
  for(ll i=1; i<a.size(); i++) res = lcm(a[i], res);
  return res;
}
bool is_prime(ll n) {
  if(n < 2) return false;
  for (ll i = 2; i * i <= n; i++) if (n % i == 0) return false;
  return true;
}
ll digsum(ll n) {
  ll res=0;
  while(n) res += n%10, n /= 10;
  return res;
}
ll digcnt(ll n){
  ll res=0;
  while(n) res++, n /= 10;
  return res;
}
vector<ll> divisor(ll n) {
  vector<ll> res;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n / i) res.push_back(n / i);
    }
  }
  sort(res.begin(), res.end());
  return res;
}
map<ll, ll> prime_factor(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) ++res[i], n /= i;
  }
  if (n != 1) res[n] = 1;
  return res;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  auto p = prime_factor(n);
  ll ans=0;
  for(auto e: p){
    ll cnt=1;
    while(e.second-cnt>=0){
      e.second-=cnt;
      cnt++;
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3660
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int a, b, c, d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  int t = (b < d ? b : d) - (a > c ? a : c) ;
  printf("%d\n", (t > 0 ? t : 0));
  return 0;
}

Measured memory_bytes: 128
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<int> > mat;

int main()
{
  int n;
  cin >> n;
  int x[200100];
  int y[200100];
  for (int i = 0; i < n; i++)
  {
    cin >> x[i];
    y[i] = x[i];
  }
  sort(y, y + n);
  int left = y[n / 2 - 1];
  int right = y[n / 2];
  for (int i = 0; i < n; i++)
  {
    cout << (x[i] <= left ? right : left) << "\n";
  }
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; ++i)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define PB push_back
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> Point;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

#ifdef WIN32
#define dump(x) cout << #x << " = " << (x) << "\n"
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n"
#else
#define dump(x)
#define debug(x)
#endif

int d, n;
VI t;
vector<pair<PII, int> > a;
int dp[ 201 ][ 201 ];

void input() {
	cin >> d >> n;
	t.resize( d );
	for ( int i = 0; i < d; i++ ) {
		cin >> t[ i ];
	}
	a.resize( n );
	for ( int i = 0; i < n; i++ ) {
		cin >> a[ i ].first.first >> a[ i ].first.second >> a[ i ].second;
	}
}

int dfs( int now, int k ) {
	if ( now == d ) {
		return 0;
	}
	if ( dp[ now ][ k ] >= 0 ) {
		return dp[ now ][ k ];
	}
	int res = 0;
	if ( now ) {
		for ( int i = 0; i < n; i++ ) {
			if ( t[ now ] >= a[ i ].first.first && a[ i ].first.second >= t[ now ] ) {
				res = max( res, dfs( now + 1, i ) + abs( a[ i ].second - a[ k ].second ) );
			}
		}
	}
	else {
		for ( int i = 0; i < n; i++ ) {
			if ( t[ now ] >= a[ i ].first.first && a[ i ].first.second >= t[ k ] ) {
				res = max( res, dfs( now + 1, i ) );
			}
		}
	}
	return dp[ now ][ k ] = res;
}

void solve() {
	NCLR( dp );
	cout << dfs( 0, 0 ) << "\n";
}

int main() {
  ios::sync_with_stdio( false );
  cin.tie( 0 );
  input();
#ifdef WIN32
  clock_t stime = clock();
#endif
  solve();
#ifdef WIN32
  clock_t etime = clock();
  cout << "TIME : " << ( double ) ( etime - stime ) / CLOCKS_PER_SEC << "\n";
#endif
  return 0;
}

Measured memory_bytes: 1376
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
const int MAX_N=1<<20;
typedef long long ll;
typedef pair<int,int>P;
int N,A[200005],T,m=INT_MAX;


int main()
{
	int mx=-1,cnt=0;
	scanf("%d%d",&N,&T);
	for(int i=0;i<N;i++)
	{
		scanf("%d",&A[i]);
		m=min(m,A[i]);
		int t=A[i]-m;
		if(t==mx)cnt++;
		else if(t>mx)
		{
			mx=t;
			cnt=1;
		}
	}
	printf("%d\n",cnt);
	return 0;
}




Measured memory_bytes: 640
//
// Created by 日熊悠太 on 2019-02-20.
//

#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if(a < b) euclidean_gcd(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

int main()
{
    int n;

    std::scanf("%d", &n);

    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::scanf("%d", &a[i]);
    }

    int gcd = euclidean_gcd(a[0], a[1]);
    for (int i = 2; i < n; i++) {
        gcd = euclidean_gcd(gcd, a[i]);
    }

    std::printf("%d\n", gcd);
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
i_str = input()
N,A,B = map(int,i_str.split())

import sys
AB = A+B
maxnum = pow(10,100)
if A == 0:
    print(0)
    sys.exit()
if N <= A:
    print(N)
    sys.exit()
waru,amari = divmod(N,AB)
#waru = (N // AB)
#amari = N % AB
if amari > A:
    amari = A
answer = waru * A + amari
print(answer)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s,s1,s2;
//vvl v;
//vl vis,d;

vector<ld>v;
ld dp[3000][3000];

int main() {
    IOS;
    cin>>n;
    v.resize(n);cin>>v;
    dp[0][0]=1;
    fo(i,n)dp[i+1][0]=dp[i][0]*(1-v[i]);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=i;j++){
            dp[i][j]=dp[i-1][j-1]*v[i-1]+dp[i-1][j]*(1-v[i-1]);
            //cout<<dp[i][j]<<" "<<i<<" "<<j<<el;
        }
    }
    ld ans=0;
    for(int i=n/2+1;i<=n;i++)ans+=dp[n][i];
    cout<<ans;
    return 0;
}


Measured memory_bytes: 139136
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;
ll llmin(ll a,ll b){
    if(a>=b) return b;
    return a;
}
ll llmax(ll a,ll b){
    if(a<=b) return b;
    return a;
}
int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> A;
    cin >> B;
    cin >> K;

    cout << llmax(0,A-K) << " ";
    cout << llmax(0,B-llmax(0,(K-A)));
   

}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
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;}

int pri[256];
string S;

int solve(int &i,int r){
    if(r==0){
        int ret=0;
        if(S[i]=='('){
            i++;
            ret=solve(i,3);
            i++;
        }
        else{
            while(isdigit(S[i])){
                ret=ret*10+S[i]-'0';
                i++;
            }
        }
        return ret;
    }

    int ret=solve(i,r-1);
    while(true){
        if(pri[S[i]]!=r)break;
        if(S[i]=='+'){
            i++;
            ret+=solve(i,r-1);
        }
        else if(S[i]=='-'){
            i++;
            ret-=solve(i,r-1);
        }
        else if(S[i]=='*'){
            i++;
            ret*=solve(i,r-1);
        }
    }
    return ret;
}

signed main(){
    cin>>S;
    S+="=";
    int ans=LLONG_MIN;
    for(int i=1;i<=3;i++){
        for(int j=1;j<=3;j++){
            for(int k=1;k<=3;k++){
                pri['+']=i;
                pri['-']=j;
                pri['*']=k;
                int idx=0;
                chmax(ans,solve(idx,3));
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3144
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
 
 
int main(){
  vector<int> A(5);
  vector<int> B(5);
  for(int i = 0; i < 5; i++) cin >> A[i];
  for(int i = 0; i < 5; i++) B[i] = 10*((A[i] + 10 - 1) / 10) - A[i];
  vector<pair<int,int>> P(5);
  for(int i = 0; i < 5; i++){
    P[i] = make_pair(B[i],A[i]);
  }
  sort(P.begin(),P.end());
  int ans  = 0;
  for(int i = 0; i < 4; i++){
    //cout << P[i].first << " " << P[i].second;
    ans += P[i].first + P[i].second;
  }
  ans += P[4].second;
  cout << ans;
}

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

struct	UnionFind {
	int		size;
	int		*par;
	int		*rank;
	UnionFind(int size): size(size), par(NULL), rank(NULL) {
		assert(size > 0);
		par = new int[size];
		rank = new int[size];
		assert(par != NULL && rank != NULL);
		for (int i = 0; i < size; ++i) {
			par[i] = i;
			rank[i] = 0;
		}
	}
	~UnionFind() {
		delete [] par;
		delete [] rank;
		par = NULL;
		rank = NULL;
	}
	int		find(int idx) {
		if (par[idx] == idx)
			return idx;
		return (par[idx] = find(par[idx]));
	}
	bool	same(int lhs, int rhs) {
		if (find(lhs) == find(rhs))
			return true;
		return false;
	}
	void	unite(int lhs, int rhs) {
		int	par_l = find(lhs), par_r = find(rhs);
		if (par_l == par_r)
			return;
		if (rank[par_l] < rank[par_r]) {
			par[par_l] = par_r;
		} else {
			par[par_r] = par_l;
			if (rank[par_l] == rank[par_r])
				++rank[par_l];
		}
	}
};

using III = tuple<int, int, int>;
using Graph = vector<vector<int>>;

vector<int>	calc_reachable(int N, const Graph &graph, int src, int dst)
{
	vector<int>		reachable_vec;
	vector<bool>	seen(N, false);
	stack<int>		stck;
	stck.push(src);
	seen.at(src) = true;
	reachable_vec.push_back(src);
	while (!stck.empty()) {
		int u = stck.top(); stck.pop();
		for (int v : graph.at(u)) {
			if (seen.at(v) || (u == src && v == dst))
				continue;
			seen.at(v) = true;
			reachable_vec.push_back(v);
			stck.push(v);
		}
	}
	return reachable_vec;
}

int	main()
{
	int	N, M;
	cin >> N >> M;
	int	S, D, C;
	vector<III>	edge(M);
	int	cost[500][500] = {};
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j)
			cost[i][j] = -1;
	}
	for (int i = 0; i < M; ++i) {
		cin >> S >> D >> C;
		--S; --D;
		edge.at(i) = make_tuple(C, S, D);
		cost[S][D] = C;
		cost[D][S] = C;
	}
	sort(edge.begin(), edge.end());
	UnionFind	uf(N);
	Graph		graph(N);	
	for (int i = 0; i < M; ++i) {
		tie(C, S, D) = edge.at(i);
		if (uf.same(S, D))
			continue;
		uf.unite(S, D);
		graph.at(S).push_back(D);
		graph.at(D).push_back(S);
	}
	int	total = 0, cnt = 0;
	for (int u = 0; u < N; ++u) {
		for (int v : graph.at(u)) {
			if (u >= v)
				continue;
			vector<int>	reachable_u = calc_reachable(N, graph, u, v);
			vector<int> reachable_v = calc_reachable(N, graph, v, u);
			bool		is_altanative = false;
			for (int u2 : reachable_u) {
				for (int v2 : reachable_v) {
					if (u2 == v2 || (u == u2 && v == v2))
						continue;
					if (cost[u][v] == cost[u2][v2]) {
						is_altanative = true;
						break;
					}
				}
				if (is_altanative)
					break;
			}
			if (!is_altanative) {
				++cnt;
				total += cost[u][v];
			}
		}
	}
	cout << cnt << " " << total << endl;
}




Measured memory_bytes: 4440
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = []
for i in range(m):
    l.append(list(map(int, input().split())))
l.sort(reverse=True, key=lambda x:x[1])
cnt = 0
for i in range(m):
    a += [l[i][1]] * l[i][0]
    cnt += l[i][0]
    if cnt >= n:
        break
a.sort(reverse=True)
print(sum(a[:n]))


Measured memory_bytes: 34768
import java.util.Scanner;
class Main{
	
    public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int x =sc.nextInt();
int y=sc.nextInt();
String ans;
if(x==2) {
	ans = x==y?"Yes":"No";
}
else if(x==4||x==6||x==9||x==11) {
	ans = (y==4||y==6||y==9||y==11)?"Yes":"No";
}
else {
	ans=(y!=2&&y!=4&&y!=6&&y!=9&&y!=11)?"Yes":"No";
}
System.out.println(ans);
 }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
typedef long long ll;
using namespace std;


int main() {
    ll a, b;
    cin>>a>>b;
    if(a>=13)
    {
        cout<<b<<endl;
    }
    else if(a>=6&&a<=12)
    {
        cout<<b/2<<endl;
    }
    else
        cout<<"0"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main(void)
{
    int a, b, c, t;
    std::cin >> a >> b >> c;
    if(a > b)
        {
            t = a;
            a = b;
            b = t;
        }
    if(a > c)
        {
            t = a;
            a = c;
            c = t;
        }
    if(b > c)
        {
            t = b;
            b = c;
            c = t;
        }
    std::cout << a << " " << b << " " << c << std::endl;
}


Measured memory_bytes: 3108
#include <iostream>

using namespace std;

int main(void){

    int N, K, i, j,*n, d, dn, count;

    cin >> N >> K;

    n = new int[N + 1];
    for (i = 0; i < N; i++) {
        n[i + 1] = i + 1;
    }

    count = N;
    for (i = 0; i < K; i++) {
        cin >> d;
        for (j = 0; j < d; j++) {
            cin >> dn;
            if (n[dn] != 0) {
                n[dn] = 0;
                count--;
            }
        }
    }

    cout << count << endl;

    delete n;

    return 0;
}


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

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n;
set<int> S[51];
set<int> map[51];


void insert(int idx,const vector<int> &vec) {
    rep(i,vec.size()) {
        map[idx].insert(vec[i]);
    }
}
void insert(int idx, const set<int> &s) {
    auto it=s.begin();
    while(it!=s.end()) {
        map[idx].insert(*it);
        ++it;
    }
}

void solve() {
    rep(i,51) S[i].clear();
    rep(i,51) map[i].clear();
    rep(i,n) {
        int a,b;
        cin>>a;
        rep(j,a) {
            cin>>b;
            S[i].insert(b);
        }
    }

    for(int d=1;d<31;d++) {
        vector<int> t;
        // 暇な人達
        rep(i,n) if(S[i].count(d)) t.pb(i);
        rep(i,t.size()) insert(t[i],t);
        rep(i,t.size()) rep(j,t.size()) insert(t[i],map[t[j]]);

        bool f=false;
        rep(i,n) f|=map[i].size()==n;
        if(f) {
            cout<<d<<endl;
            return;
        }
        
    }

    cout<<"-1"<<endl;
}

int main() {
    while(cin>>n) {
        if(n==0) break;
        solve();
    }
    return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)

int main(void) {
	int a, b, c, d; cin >> a >> b >> c >> d;
	cout << (a * b >= c * d ? a * b : c * d) << endl;
	return 0;
}

Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	string s, t;
    while(cin >> s) {
        if(s == ".") break;
        cin >> t;
        if(s == t) {
            cout << "IDENTICAL" << endl;
            continue;
        }
        bool ok = 0;
        int n = (int)s.size(), m = (int)t.size();
        int cnt = 0;
        int i = 0, j = 0;
        for(;i < n || j < m;) {
            if((i == n && j < m) || (i < n && j == m)) {
                cout << "DIFFERENT" << endl;
                ok = 1;
                break;
            }
            if(s[i] != t[j]) {
                cout << "DIFFERENT" << endl;
                ok = 1;
                break;
            }
            if(s[i] == '"') {
                string a = "", b = "";
                while(i + 1 < n && s[i + 1] != '"') {
                    a += s[i + 1];
                    ++ i;
                }
                if(i + 1 < n && s[i + 1] != '"') {
                    cout << "DIFFERENT" << endl;
                    ok = 1;
                    break;      
                }
                i += 2;
                while(j + 1 < m && t[j + 1] != '"') {
                    b += t[j + 1];
                    ++ j;
                }
                if(j + 1 < m && t[j + 1] != '"') {
                    cout << "DIFFERENT" << endl;
                    ok = 1;
                    break;      
                }
                j += 2;
                if(a != b) ++ cnt;
            } else {
                i ++, j ++;
            }
        }
        if(ok) continue;
        if(cnt == 1) {
            cout << "CLOSE" << endl;
        } else {
            cout << "DIFFERENT" << endl;
        }
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}


Measured memory_bytes: 3244
#include <iostream>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
using namespace std;
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
int A[1000][1000];
int main() {
  int N; cin >> N;
  REP(i, N) REP(j, N - 1) {
    cin >> A[i][j];
    A[i][j]--;
  }
  int ans = 0;
  int p[1000];
  memset(p, 0, sizeof(p));

  queue<int> Q;
  set<int> end;
  REP(i,N) {
    end.insert(i);
    int o = A[i][p[i]];
    if (A[o][p[o]] == i) {
      Q.push(i);
    }
  }

  while (true) {
    ans++;
    // cerr << "ans = " << ans << endl;
    queue<int> Q2;
    while (!Q.empty()) {
      int u = Q.front();
      Q.pop();
      // cerr << "u = " << u << endl;
      Q2.push(u);
      p[u]++;
    }
    set<int> skip;
    while (!Q2.empty()) {
      int u = Q2.front();
      Q2.pop();
      if (p[u] < N - 1) {
        int o = A[u][p[u]];
        if (skip.count(u) == 0 && A[o][p[o]] == u) {
          Q.push(u);
          Q.push(o);
          skip.insert(o);
          // cerr << "push " << u << endl;
        }
      } else {
        end.erase(u);
      }
    }
    if (end.size() == 0) {
      break;
    }
    if (Q.empty()) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4224
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	} 
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanString()
	f := false
	for _, e := range n {
		if e == '7' {
			f = true
		}
	}

	if f {
		fmt.Fprintln(wr, "Yes")
	} else {
		fmt.Fprintln(wr, "No")
	}
}


Measured memory_bytes: 1760
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void PR(bool f){
  cout << (f ? "APPROVED" : "DENIED") << endl;
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  vll a(n);
  rep(i, n){
    cin >> a[i];
  }
  rep(i, n){
    if(a[i]%2==0 && (a[i]%3!=0 && a[i]%5 != 0)){
      PR(0);
    }
  }
  PR(1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long power(long long A,long long B,long long M){
    if(B==0){
        return 1;
    }
    else if(B%2==0){
        long long s=power(A,B/2,M);
        return (s*s)%M;
    }
    else{
        return ((A%M)*power(A,B-1,M))%M;
    }
}

int main(){
    long long MOD=1000000007;
    long long n;
    long long a;
    long long b;
    cin>>n>>a>>b;
    long long N=power(2,n,MOD);
    vector<long long>comb(b);
    comb.at(0)=n%MOD;
    for(long long i=1;i<b;i++){
        comb.at(i)=(((comb.at(i-1)*power(i+1,MOD-2,MOD))%MOD)*((n-i)%MOD))%MOD;
    }
    long long A=N-1-comb.at(a-1);
    if(A<0){
        A=A+MOD;
    }
    long long B=A-comb.at(b-1);
    if(B<0){
        B=B+MOD;
    }
    cout<<B%MOD<<endl;
}

Measured memory_bytes: 1792
import math

if __name__ == '__main__':
    N, H = map(int, input().split())
    a = []
    b = []
    for _ in range(N):
        tmp_a, tmp_b = map(int, input().split())
        a.append(tmp_a)
        b.append(tmp_b)

    max_a = max(a)
    ans = 0
    b = sorted(b, reverse=True)
    damage = 0
    for i in range(N):
        if max_a < b[i]:
            damage += b[i]
            ans += 1
        else:
            break

        if H <= damage:
            print(ans)
            exit()

    ans += math.ceil((H - damage) / max_a)

    print(ans)


Measured memory_bytes: 12160
// --------------
// Tejas Pandey  |
// 28 - 06 - 19  |
// Atcoder #132  |
// --------------

#include <bits/stdc++.h>
using namespace std;

#define mod 1000000007
#define vi vector<int>
typedef long long int ll;

int main (void)
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int n;
	cin >> n;
	int a[n];
	for(int i = 0;i < n;i++)
	cin >> a[i];
	int ans = 0;
	for(int i = 1;i < n-1;i++)
	if((a[i] > a[i+1] && a[i] < a[i-1]) || (a[i] < a[i+1] && a[i] > a[i-1]))
	ans++;
	cout << ans;
	return 0;
}

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

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 998244353ll;
const ll MAXN = (ll) 1e6 + 10;
const ll INF = (ll) 9223372036854775;
const ld EPS = (ld) 1e-8;

vector<str> now, fut, all;

bool has(str t, char c){
	for(auto y : t){
		if(y == c) return true;
	}
	return false;
}
bool valid(str s){
	return has(s, '3') and has(s,'5') and has(s,'7');
}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	now.pb("3");
	now.pb("5");
	now.pb("7");
	for(int i = 2 ;i<=9;i++){
		fut.clear();
		for(auto x : now){
			fut.pb("3" + x);
			fut.pb("5" + x);
			fut.pb("7" + x);
			all.pb("3" + x);
			all.pb("5" + x);
			all.pb("7" + x);	
		}
		now.clear();
		for(auto x : fut) now.pb(x);
	}
	
	str s;
	cin >> s;
	while(s.size() < 9) s = '0' + s;
	debug(s);
	ll ans = 0;
	str t;
	for(auto x : all){
		t = x;
		while(t.size() < 9) t = '0' + t;
		if( (t <= s) and valid(t))ans ++;
	}
	cout << ans;
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/




Measured memory_bytes: 3580
N, K = [int(x) for x in input().split(' ')]
m = 10**9 + 7
fact = [1] * (N+1)
for i in range(1, N+1):
  fact[i] = fact[i-1] * i
  
def combination(n, r):
  return fact[n] // fact[r] // fact[n-r]
  
for k in range(1, K+1):
  print(combination(N-K+1, k) % m * combination(K-1, k-1) % m)


Measured memory_bytes: 5748
#include <iostream>
#include <set>

using namespace std;

#define MAX_N 200000
int A[MAX_N];
multiset<int> inverted;

inline int invert(int x) {
    int inv{1};
    while (inv <= x) inv <<= 1;
    return inv - x;
}

int main() {
    int N; scanf("%d", &N);
    for (int i{}; i < N; ++i) scanf("%d", &A[i]);
    sort(A, A + N);

    int count{};
    for (int i{N-1}; i >= 0; --i) {
        const auto& found = inverted.find(A[i]);
        if (found != inverted.end()) {
            inverted.erase(found);
            ++count;
        } else {
            inverted.insert(invert(A[i]));
        }
    }

    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};
const int N=2e5+5;
vector<int> g[N];
int d[N];
void dfs(int v,int p=0){
    int cnt=0;
    for(int to:g[v]){
        if(to^p){
            dfs(to,v);
            cnt++;
            d[v]^=d[to]+1;
        }
    }
}
int32_t main(){
    int n;
    cin>>n;
    forn(i,n-1){
        int x,y;
        cin>>x>>y;
        g[x].pb(y);
        g[y].pb(x);
    }
    dfs(1);
    if(d[1])cout<<"Alice\n";
    else cout<<"Bob\n";
    return 0;
}

Measured memory_bytes: 18460
n = int(input())
dp = [-1] * (n+1)
dp[0] = 1
if n >= 1:
    dp[1] = 1


def fib(i):
    if dp[i] > 0:
        return dp[i]
    else:
        dp[i] = fib(i-1) + fib(i-2)
        return dp[i]


print(fib(n))



Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s,t;int cnt=0;
    cin>>s>>t;
    for(ll i=0,j=0;i<s.size();i++,j++)
    {
        if(s[i]!=t[i])
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3916
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define prique priority_queue
#define umap unordered_map
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int int_fast64_t

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int A, B; cin >> A >> B;
  cout << GCD(A, B) << endl;
}


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

using namespace std;

#define LL long long
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    LL i,n,a[85],ans=1000,cnt=0,cur=1000;
    bool buy[85],sell[85];
    cin >> n;
    for(i=1;i<=n;i++)cin >> a[i],buy[i]=sell[i]=true;
    for(i=1;i<n;i++)
    {
        if(a[i] >= a[i+1])buy[i]=sell[i+1]=false;
        else buy[i+1]=sell[i]=false;
    }
    for(i=1;i<=n;i++)
    {
        if(buy[i])cnt=cur/a[i],cur%=a[i];
        else if(sell[i])cur+=cnt*a[i],cnt=0,ans=max(ans,cur);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3648
program sample
    implicit none
  
    integer(8) :: i,j,m,n,a,b,t,a0,b0,t0
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n
    a0=0
    b0=0
    t0=0
    do i=1,n
        read(*,*)t,a,b
        m=abs(a-a0)+abs(b-b0)
        if (m>t-t0)then
            write(*,*)'No'
            stop
        elseif(mod(m,2)/=mod(t-t0,2))then
            write(*,*)'No'
            stop
        end if
        a0=a
        b0=b
        t0=t
    end do


  
    write(*,*) 'Yes'
  
    stop
end program sample
  



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

#define PI 3.14159265358
typedef long long ll; 
typedef long double ld; 

int main() {
	int n, m, x, ans = 1000000000, i, j;
	cin >> n >> m >> x;
	vector<vector<int>> set(n, vector<int>(m));
	vector<int> skills(m), cost(m);
	for(i = 0; i < n; i++) {
		cin >> cost[i];
		for(j = 0; j < m ; j++) {
			cin >> set[i][j];
			skills[j] = 0;
		}
	}
	int se = 1 << n;
	int  t = 0;
	for(int mask = 0; mask < se; mask++) {
		t = 0;
		for(i = 0; i < n; i++) {
			if((mask >> i)&1) {
				t += cost[i];
				for(j = 0; j < m; j++) {
					skills[j] += set[i][j];
				}
			}
		}
		bool ok = true; 
		for(j = 0; j < m; j++) {
			if(skills[j] < x) {
				ok = false;
			}
			skills[j] = 0;
		}
		if(ok) {
			ans = min(ans, t);
		}
	}
	if(ans == 1000000000) {
		cout << -1 << "\n";
	} else cout << ans << "\n"; 
	
	return 0;
}


Measured memory_bytes: 3572
#include<stdio.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

long long cnt;
int l,n;
int A[1000000];
vector<int> G;


void insertion(int A[], int n,int g){
  int i,V,j;
  for ( i = g; i < n; i++ ){
  V=A[i];
  j=i-g;
  while (j>=0 && A[j]>V){
	  A[j+g]=A[j];
      j -= g;
      cnt++;
  }
  A[j+g]=V;
  }
}

void shellsort(int A[], int n){
  for(int h=1;;){
  if(h>n) break;
  G.push_back(h);
  h=3*h+1;
  }
  for(int i= G.size()-1;i>=0;i--){
  insertion(A,n,G[i]);
  }
}

int main(){
  scanf("%d", &n);
  for (int i = 0; i < n; i++ ) scanf("%d", &A[i]);
  cnt=0;
  shellsort(A,n);
  cout << G.size() << endl;
  for(int i= G.size()-1;i>=0;i--){
    printf("%d", G[i]);
    if ( i ) printf(" ");
  }
  printf("\n");
  printf("%d\n",cnt);
  for(int i=0;i<n;i++) printf("%d\n",A[i]);
  return 0;
}

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

#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)

int H, W;
int mem[50];

signed main()
{
    cin >> H >> W;
    rep(i, H)rep(j, W)
    {
        char c;
        cin >> c;
        mem[c - 'a']++;
    }

    int N = 'z' - 'a' + 1;
    if(H % 2 && W % 2)
    {
        rep(i, N)
        {
            if(mem[i] % 2)
            {
                mem[i]--;
                break;
            }
        }
        rep(i, (H / 2) * (W / 2))
        {
            rep(j, N)if(mem[j] >= 4)
            {
                mem[j] -= 4;
                break;
            }
        }
        rep(i, H / 2 + W / 2)
        {
            rep(j, N)if(mem[j] >= 2)
            {
                mem[j] -= 2;
                break;
            }
        }
        rep(i, N + 1)
        {
            if(i == N)
            {
                cout << "Yes" << endl;
                return 0;
            }
            if(mem[i] != 0)
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    
    if(W % 2  == 1 && H % 2 == 0)swap(H, W);
    if(H % 2 && W % 2 == 0)
    {
        rep(i, (H / 2) * (W / 2))
        {
            rep(j, N)if(mem[j] >= 4)
            {
                mem[j] -= 4;
                break;
            }
        }
        rep(i, W / 2)
        {
            rep(j, N)if(mem[j] >= 2)
            {
                mem[j] -= 2;
                break;
            }
        }
        rep(i, N + 1)
        {
            if(i == N)
            {
                cout << "Yes" << endl;
                return 0;
            }
            if(mem[i] != 0)
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    rep(i, H * W / 4)
    {
        rep(j, N)if(mem[j] >= 4)
        {
            mem[j] -= 4;
            break;
        }
    }
    rep(i, N + 1)
    {
        if(i == N)
        {
            cout << "Yes" << endl;
            return 0;
        }
        if(mem[i] != 0)
        {
            cout << "No" << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define IOS                \
  ios::sync_with_stdio(0); \
  cin.tie(0);              \
  cout.tie(0);
#define int long long
const unsigned int M = 1000000007;
using namespace std;
int32_t main()
{
  IOS int n;
  cin >> n;
  int times = n / 1000;
  if (1000 * times == n)
  {
    cout << 0 << endl;
  }
  else
  {
    cout << 1000 * (times + 1) - n << endl;
  }

  return 0;
}


Measured memory_bytes: 3604